@altnovatrail/spec 0.10.1 → 0.11.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
@@ -1,6 +1,6 @@
1
1
  # @altnovatrail/spec
2
2
 
3
- The types of [NovaTrail](https://github.com/altnovatrail)'s module format for TypeScript, and from 0.8.0 on those of its admission table. The package covers:
3
+ The types of [NovaTrail](https://github.com/altnovatrail)'s module format for TypeScript, from 0.8.0 on those of its admission table, and from 0.11.0 on those of its deployment configuration. The package covers:
4
4
  - the parts of a module and their open views;
5
5
  - the canonical view and the inventory of a package;
6
6
  - the module index;
@@ -14,6 +14,8 @@ From 0.8.0 on, it holds the types of the admission table too: which AI provider,
14
14
 
15
15
  From 0.10.0 on, it holds the page of the workbook too, which format 0.4 makes a rule: `@altnovatrail/spec/format/page.json`, the numbers and the widths by which every page is laid out, and `@altnovatrail/spec/format/vectors/pages/<case>.json`, the test vectors of the page, each the JSON of the format's [`page.yaml`](https://github.com/altnovatrail/spec/blob/main/format/page.yaml) and of its vectors, `format/vectors/pages/` ([the format's text](https://github.com/altnovatrail/spec/blob/main/format/README.md), section 14). A canvas reads them to lay its page out, and its tests check its layout against the vectors; their types are `Page` and `PageVector` of `formatv0`.
16
16
 
17
+ From 0.11.0 on, it holds the types of the deployment configuration too: the file `/deployment.json`, which the learner's app reads at its start from the root of its origin, with the origin of the platform's API and the parameters of the sign-in service ([the format's text](https://github.com/altnovatrail/spec/blob/main/deployment/README.md)). They are generated from its schemas, `deployment/schemas`, as the format's are, and the fields of the file keep their names in camelCase, such as `signIn.apiKey`.
18
+
17
19
  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:
18
20
 
19
21
  ```ts
@@ -33,6 +35,7 @@ function show(task: open.Task, manifest: open.Manifest) {
33
35
  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.
34
36
  - **`@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.
35
37
  - **`@altnovatrail/spec/admissionv0`** holds the types of the admission table's major version 0: the table, with its providers, deployment facts, rules of capabilities and cells, and the test vectors of the admission function's answers.
38
+ - **`@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.
36
39
  - **`@altnovatrail/spec/canvas`** holds the types of `<novatrail-canvas>`:
37
40
  - `CanvasElement`, which describes the element's properties `tool`, `task`, `workedExample`, `demoState`, `manifest`, `media`, `history`, `marks` and `filled` and its method `exportWork()`;
38
41
  - `Media`, the function by which the consumer gives the files of the pictures: the canvas goes to no network;
@@ -0,0 +1,119 @@
1
+ // Code generated by tools/types from deployment/schemas; DO NOT EDIT.
2
+
3
+ /**
4
+ * The types of the deployment configuration, version 1, generated from the schemas in
5
+ * deployment/schemas by tools/types (R72, R73 and R85 in spec's docs/decisions.md): the same types
6
+ * as the Go package deploymentv1, by the same names — the file /deployment.json, whose fields keep
7
+ * the names of R09 app, in camelCase, and the vectors of reading. A vector's file is any JSON
8
+ * value, unknown, as a reader gets it. The schemas decide what is valid: a type gives the shape of
9
+ * a value alone, and code that reads a value from elsewhere checks it against its schema first, and
10
+ * then against the rules of reading (deployment/README.md, section 5). A field the object always
11
+ * holds is required; any other is optional.
12
+ *
13
+ * @packageDocumentation
14
+ */
15
+
16
+ // The types of deployment.schema.json.
17
+
18
+ /**
19
+ * Deployment is the type of deployment.schema.json.
20
+ *
21
+ * The file /deployment.json, which app reads at every start from the root of its origin, beside its
22
+ * signed build (section 4 of the deployment text). It holds no secret: every browser that opens app
23
+ * gets it.
24
+ */
25
+ export interface Deployment {
26
+ /**
27
+ * The version of the format, the integer in deployment/VERSION.
28
+ */
29
+ readonly format: number;
30
+ /**
31
+ * The origin of api: a scheme, a host in lower case and perhaps a port, with no path, query,
32
+ * fragment or credentials; https, or http on a loopback host. That it is equal to its own origin,
33
+ * and that http needs app itself on a loopback host, are rules of reading (section 5).
34
+ */
35
+ readonly api: string;
36
+ /**
37
+ * The sign-in service and the parameters of its project.
38
+ */
39
+ readonly signIn: SignIn;
40
+ }
41
+
42
+ /**
43
+ * SignIn is the type of deployment.schema.json#/$defs/sign_in.
44
+ */
45
+ export interface SignIn {
46
+ /**
47
+ * The sign-in service: Firebase Auth. Another service is another adapter, in api and in app.
48
+ */
49
+ readonly service: string;
50
+ /**
51
+ * The key of the Firebase web app, as the Firebase console gives it.
52
+ */
53
+ readonly apiKey: Parameter;
54
+ /**
55
+ * The host of the Firebase sign-in pages, with no scheme and no path, such as
56
+ * example-project.firebaseapp.com.
57
+ */
58
+ readonly authDomain: string;
59
+ /**
60
+ * The ID of the Firebase project.
61
+ */
62
+ readonly projectId: Parameter;
63
+ /**
64
+ * The ID of the Firebase web app.
65
+ */
66
+ readonly appId: Parameter;
67
+ }
68
+
69
+ /**
70
+ * Parameter is the type of deployment.schema.json#/$defs/parameter.
71
+ */
72
+ export type Parameter = string;
73
+
74
+ // The types of reading-vector.schema.json.
75
+
76
+ /**
77
+ * ReadingVector is the type of reading-vector.schema.json.
78
+ *
79
+ * A test vector of reading (section 7 of the deployment text): files of a deployment configuration,
80
+ * each with the origin where app is open and what section 5 gives. A reader implements section 5
81
+ * and gets exactly this.
82
+ */
83
+ export interface ReadingVector {
84
+ /**
85
+ * The files, each read once.
86
+ */
87
+ readonly cases: readonly Case[];
88
+ }
89
+
90
+ /**
91
+ * Case is the type of reading-vector.schema.json#/$defs/case.
92
+ */
93
+ export interface Case {
94
+ /**
95
+ * The origin where app is open, as the URL Standard serializes it.
96
+ */
97
+ readonly origin: string;
98
+ /**
99
+ * The file as JSON reads it: any JSON value, not only one the schema accepts.
100
+ */
101
+ readonly file: unknown;
102
+ /**
103
+ * The step that refuses the file: the schema, or the ID of the rule. Left out when the reader
104
+ * accepts the file.
105
+ */
106
+ readonly refused_by?: CaseRefusedBy;
107
+ /**
108
+ * Every field that step refuses, in the order of code units.
109
+ */
110
+ readonly fields?: readonly string[];
111
+ }
112
+
113
+ /**
114
+ * CaseRefusedBy is the type of reading-vector.schema.json#/$defs/case/properties/refused_by.
115
+ *
116
+ * The step that refuses the file: the schema, or the ID of the rule. Left out when the reader
117
+ * accepts the file.
118
+ */
119
+ export type CaseRefusedBy = "schema" | "deployment.api-origin" | "deployment.loopback";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@altnovatrail/spec",
3
- "version": "0.10.1",
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.",
3
+ "version": "0.11.0",
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.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -23,13 +23,17 @@
23
23
  },
24
24
  "./format/page.json": "./format/page.json",
25
25
  "./format/vectors/pages/*.json": "./format/vectors/pages/*.json",
26
+ "./deploymentv1": {
27
+ "types": "./deploymentv1/index.d.ts"
28
+ },
26
29
  "./package.json": "./package.json"
27
30
  },
28
31
  "files": [
29
32
  "formatv0",
30
33
  "canvas",
31
34
  "admissionv0",
32
- "format"
35
+ "format",
36
+ "deploymentv1"
33
37
  ],
34
38
  "sideEffects": false
35
39
  }