@altnovatrail/spec 0.17.12 → 0.18.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 CHANGED
@@ -28,6 +28,8 @@ From 0.14.0 on, it holds the types of the files of an export too: the file the o
28
28
 
29
29
  From 0.17.0 on, `@altnovatrail/spec/exportv2` takes the place of `@altnovatrail/spec/exportv1`: the types of the part's version 2, whose profile carries its stored works, `works`, each with its history of writing, the contexts of its submissions and its picture, in place of `artefacts`. A consumer of 0.16 that imports `exportv1` imports `exportv2` from 0.17 on.
30
30
 
31
+ From 0.18.0 on, `@altnovatrail/spec/exportv3` takes the place of `@altnovatrail/spec/exportv2`: the types of the part's version 3, whose profile names its stored works without their bytes, `WorkInfo`, and each stored work is a file of its own beside the part of `api`, `Work`. A consumer of 0.17 that imports `exportv2` imports `exportv3` from 0.18 on.
32
+
31
33
  The types are declarations alone, with no code to run, so import them with `import type`; the page's JSON is data, which a module imports with `with { type: "json" }` or reads as a file:
32
34
 
33
35
  ```ts
@@ -50,7 +52,7 @@ function show(task: open.Task, manifest: open.Manifest) {
50
52
  - **`@altnovatrail/spec/deploymentv1`** holds the types of the deployment configuration's version 1: the file, `Deployment`, and the test vectors of reading it, `ReadingVector`, whose file is any JSON value, `unknown`. A type gives the shape alone: a reader checks the file against its schema and then against the rules of reading, section 5 of the format's text.
51
53
  - **`@altnovatrail/spec/legalv3`** holds the types of version 3 of the legal texts: the passport, `Legal`, with each `Text` and its `TextVersion` with its `translations`, each `Set` and its `SetVersion`, and the test vectors of reading the part, `ReadingVector`, whose passport is any JSON value, `unknown`. A type gives the shape alone: a reader checks the passport against its schema and then the part against the rules of reading, section 5 of the part's text.
52
54
  - **`@altnovatrail/spec/consentagev1`** holds the types of version 1 of the table of the age of digital consent: the table, `ConsentAge`, with each country's `Entry`, the `Country` codes, and the test vectors of reading the table, `ReadingVector`, whose table is any JSON value, `unknown`, and of the category, `CategoryVector`. A type gives the shape alone: a reader checks the table against its schema and then against the rules of reading, section 5 of the part's text, and computes a learner's category as the part's text says.
53
- - **`@altnovatrail/spec/exportv2`** holds the types of version 2 of the format of the export: `Manifest`, `Account`, `Profile` with its `Attempt`, `Submission`, `Choice`, `EvidenceEntry`, `StateEntry` and `Work`, `Device`, and the test vectors of reading an export, `ReadingVector`. A type gives the shape alone: a reader checks each file against its schema and then the export against the rules of reading, section 5 of the part's text.
55
+ - **`@altnovatrail/spec/exportv3`** holds the types of version 3 of the format of the export: `Manifest`, `Account`, `Profile` with its `Attempt`, `Submission`, `Choice`, `EvidenceEntry`, `StateEntry` and `WorkInfo`, `Device`, `Work`, and the test vectors of reading an export, `ReadingVector`. A type gives the shape alone: a reader checks each file against its schema and then the export against the rules of reading, section 5 of the part's text.
54
56
  - **`@altnovatrail/spec/canvas`** holds the types of `<novatrail-canvas>`:
55
57
  - `CanvasElement`, which describes the element's properties `tool`, `task`, `workedExample`, `demoState`, `manifest`, `media`, `history`, `marks` and `filled` and its method `exportWork()`;
56
58
  - `Media`, the function by which the consumer gives the files of the pictures: the canvas goes to no network;
@@ -1,7 +1,7 @@
1
1
  // Code generated by tools/types from admission/schemas; DO NOT EDIT.
2
2
 
3
3
  /**
4
- * The types of the admission table, major version 0, generated from the schemas of version 0.3 in
4
+ * The types of the admission table, major version 0, generated from the schemas of version 0.4 in
5
5
  * admission/schemas by tools/types (R72, R73 and R96 in spec's docs/decisions.md): the same types
6
6
  * as the Go package admissionv0, by the same names — the table, and the vectors of answers of the
7
7
  * admission function. The schemas decide what is valid: a type gives the shape of a value alone,
@@ -1,15 +1,16 @@
1
1
  // Code generated by tools/types from export/schemas; DO NOT EDIT.
2
2
 
3
3
  /**
4
- * The types of the format of the export, version 2 of the part, generated from the schemas in
4
+ * The types of the format of the export, version 3 of the part, generated from the schemas in
5
5
  * export/schemas by tools/types (R72, R73 and R135 in spec's docs/decisions.md): the same types as
6
- * the Go package exportv2, by the same names — the files of an export, the manifest, the account, a
7
- * profile with every record of it and what a device holds of it, and the vectors of reading. A
8
- * field that holds the JSON of a message of protobuf, or a value as the element <novatrail-canvas>
9
- * gives it, is any JSON value, unknown, as a reader gets it. The schemas decide what is valid: a
10
- * type gives the shape of a value alone, and code that reads a value from elsewhere checks it
11
- * against its schema first, and then against the rules of reading (export/README.md, section 5). A
12
- * field the object always holds is required; any other is optional.
6
+ * the Go package exportv3, by the same names — the files of an export, the manifest, the account, a
7
+ * profile with every record of it, what a device holds of it and a stored work, and the vectors of
8
+ * reading. A field that holds the JSON of a message of protobuf, or a value as the element
9
+ * <novatrail-canvas> gives it, is any JSON value, unknown, as a reader gets it. The schemas decide
10
+ * what is valid: a type gives the shape of a value alone, and code that reads a value from
11
+ * elsewhere checks it against its schema first, and then against the rules of reading
12
+ * (export/README.md, section 5). A field the object always holds is required; any other is
13
+ * optional.
13
14
  *
14
15
  * @packageDocumentation
15
16
  */
@@ -57,7 +58,7 @@ export interface Account {
57
58
  /**
58
59
  * The IDs of the account's profiles, each with its file in profiles/.
59
60
  */
60
- readonly profile_ids: readonly ID[];
61
+ readonly profile_ids: readonly FileID[];
61
62
  /**
62
63
  * Every consent of the account, in full: the minimal record left after a deletion is none (R117).
63
64
  */
@@ -91,6 +92,15 @@ export type Time = string;
91
92
  */
92
93
  export type Day = string;
93
94
 
95
+ /**
96
+ * FileID is the type of common.schema.json#/$defs/file_id.
97
+ *
98
+ * An ID that names a file of the export, a profile's or an attempt's, as api gives it: 1 to 200
99
+ * letters, digits, -, _ and ., the first not a ., so that it is one part of a path, never . or ..
100
+ * (section 3).
101
+ */
102
+ export type FileID = string;
103
+
94
104
  /**
95
105
  * Consent is the type of common.schema.json#/$defs/consent.
96
106
  */
@@ -228,6 +238,14 @@ export interface WorkSubmission {
228
238
  readonly history_length: number;
229
239
  }
230
240
 
241
+ /**
242
+ * WorkKind is the type of common.schema.json#/$defs/work_kind.
243
+ *
244
+ * What a stored work is, by its task: handwriting on an item with a verdict, an essay by a rubric,
245
+ * or a drawing.
246
+ */
247
+ export type WorkKind = "handwriting" | "essay" | "drawing";
248
+
231
249
  // The types of device.schema.json.
232
250
 
233
251
  /**
@@ -244,7 +262,7 @@ export interface Device {
244
262
  /**
245
263
  * The ID of the profile.
246
264
  */
247
- readonly profile_id: ID;
265
+ readonly profile_id: FileID;
248
266
  /**
249
267
  * The unfinished attempts this device holds.
250
268
  */
@@ -432,7 +450,7 @@ export interface Profile {
432
450
  /**
433
451
  * The ID of the profile.
434
452
  */
435
- readonly profile_id: ID;
453
+ readonly profile_id: FileID;
436
454
  /**
437
455
  * Whether this is the profile of the account's owner.
438
456
  */
@@ -516,10 +534,11 @@ export interface Profile {
516
534
  */
517
535
  readonly state: StateEntry;
518
536
  /**
519
- * The stored works, the works of the profile kept on the server, newest first; empty while
520
- * storage is off (R113).
537
+ * The stored works, the works of the profile kept on the server, newest first, each named without
538
+ * its bytes, as ListWorks names it; each is a file of its own beside api.zip, which app writes
539
+ * (R151). Empty while storage is off (R113).
521
540
  */
522
- readonly works: readonly Work[];
541
+ readonly works: readonly WorkInfo[];
523
542
  /**
524
543
  * Whether the storage of the profile's works on the server is on (R113).
525
544
  */
@@ -1225,16 +1244,15 @@ export interface StateEntryModule {
1225
1244
  }
1226
1245
 
1227
1246
  /**
1228
- * Work is the type of profile.schema.json#/$defs/work.
1247
+ * WorkInfo is the type of profile.schema.json#/$defs/work_info.
1229
1248
  */
1230
- export interface Work {
1249
+ export interface WorkInfo {
1231
1250
  /**
1232
1251
  * The attempt whose work it is.
1233
1252
  */
1234
- readonly attempt_id: ID;
1253
+ readonly attempt_id: FileID;
1235
1254
  /**
1236
- * What the work is, by its task: handwriting on an item with a verdict, an essay by a rubric, or
1237
- * a drawing.
1255
+ * What the work is.
1238
1256
  */
1239
1257
  readonly kind: WorkKind;
1240
1258
  /**
@@ -1242,30 +1260,12 @@ export interface Work {
1242
1260
  */
1243
1261
  readonly stored_at: Time;
1244
1262
  /**
1245
- * The history of writing as the canvas gave it, the JSON array its bytes hold, not their base64:
1246
- * write/erase/clear/undo events with t; strokes with id, kind and points x, y, t, p.
1247
- */
1248
- readonly history: unknown;
1249
- /**
1250
- * Each submission of the attempt, in order: its context, as the canvas gave it, and the history
1251
- * length when it was sent.
1252
- */
1253
- readonly submissions: readonly WorkSubmission[];
1254
- /**
1255
- * The picture of the work: the PNG of the strokes the surface shows at the end, in base64 (RFC
1256
- * 4648, section 4).
1263
+ * The size of the work, in bytes: the sum of the bytes of its history, of the contexts of its
1264
+ * submissions and of its picture, at most 4 MiB.
1257
1265
  */
1258
- readonly picture: string;
1266
+ readonly size_bytes: number;
1259
1267
  }
1260
1268
 
1261
- /**
1262
- * WorkKind is the type of profile.schema.json#/$defs/work/properties/kind.
1263
- *
1264
- * What the work is, by its task: handwriting on an item with a verdict, an essay by a rubric, or a
1265
- * drawing.
1266
- */
1267
- export type WorkKind = "handwriting" | "essay" | "drawing";
1268
-
1269
1269
  /**
1270
1270
  * StorageConsent is the type of profile.schema.json#/$defs/storage_consent.
1271
1271
  */
@@ -1403,4 +1403,50 @@ export interface Case {
1403
1403
  * The step that refuses the export: the schema, or the ID of the rule. Left out when the reader
1404
1404
  * accepts it.
1405
1405
  */
1406
- export type CaseRefusedBy = "schema" | "export.files" | "export.scope" | "export.profiles" | "export.proto";
1406
+ export type CaseRefusedBy = "schema" | "export.files" | "export.scope" | "export.profiles" | "export.works" | "export.case" | "export.proto";
1407
+
1408
+ // The types of work.schema.json.
1409
+
1410
+ /**
1411
+ * Work is the type of work.schema.json.
1412
+ *
1413
+ * A stored work of a profile, works/<profile id>/<attempt id>.json, which app writes beside api.zip
1414
+ * as GetWork gave it (section 4 of the text of the part; R151).
1415
+ */
1416
+ export interface Work {
1417
+ /**
1418
+ * The version of the part, the integer in export/VERSION.
1419
+ */
1420
+ readonly format: number;
1421
+ /**
1422
+ * The ID of the profile whose work it is.
1423
+ */
1424
+ readonly profile_id: FileID;
1425
+ /**
1426
+ * The attempt whose work it is.
1427
+ */
1428
+ readonly attempt_id: FileID;
1429
+ /**
1430
+ * What the work is, as api set it.
1431
+ */
1432
+ readonly kind: WorkKind;
1433
+ /**
1434
+ * When api kept the work, the last time it was put.
1435
+ */
1436
+ readonly stored_at: Time;
1437
+ /**
1438
+ * The history of writing as the canvas gave it, the JSON array its bytes hold, not their base64:
1439
+ * write/erase/clear/undo events with t; strokes with id, kind and points x, y, t, p.
1440
+ */
1441
+ readonly history: unknown;
1442
+ /**
1443
+ * Each submission of the attempt, in order: its context, as the canvas gave it, and the history
1444
+ * length when it was sent.
1445
+ */
1446
+ readonly submissions: readonly WorkSubmission[];
1447
+ /**
1448
+ * The picture of the work: the PNG of the strokes the surface shows at the end, in base64 (RFC
1449
+ * 4648, section 4).
1450
+ */
1451
+ readonly picture: string;
1452
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altnovatrail/spec",
3
- "version": "0.17.12",
3
+ "version": "0.18.0",
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. And the types of the admission table, which says which AI provider may serve which age category. And the numbers and widths of the workbook's page and its test vectors, as JSON, by which a canvas lays the page out. And the types of the deployment configuration, the file /deployment.json that the app reads at its start. And the types of the legal texts' passport, which names each text, its versions and the sets of texts of the samples page. And the types of the table of the age of digital consent, which gives each country's age with the law that sets it. And the types of the files of an export, the file the owner of an account gets of a profile or of the account.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -32,8 +32,8 @@
32
32
  "./consentagev1": {
33
33
  "types": "./consentagev1/index.d.ts"
34
34
  },
35
- "./exportv2": {
36
- "types": "./exportv2/index.d.ts"
35
+ "./exportv3": {
36
+ "types": "./exportv3/index.d.ts"
37
37
  },
38
38
  "./package.json": "./package.json"
39
39
  },
@@ -45,7 +45,7 @@
45
45
  "deploymentv1",
46
46
  "legalv3",
47
47
  "consentagev1",
48
- "exportv2"
48
+ "exportv3"
49
49
  ],
50
50
  "sideEffects": false
51
51
  }