@sdboyer/thema-ui 0.0.0-bootstrap.0 → 0.1.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/LICENSE +201 -0
- package/README.md +24 -1
- package/dist/Diagnostics.d.ts +8 -0
- package/dist/Diagnostics.js +14 -0
- package/dist/Editor.d.ts +12 -0
- package/dist/Editor.js +95 -0
- package/dist/OpBar.d.ts +14 -0
- package/dist/OpBar.js +15 -0
- package/dist/Output.d.ts +20 -0
- package/dist/Output.js +56 -0
- package/dist/Tabs.d.ts +15 -0
- package/dist/Tabs.js +23 -0
- package/dist/cue-lang.d.ts +8 -0
- package/dist/cue-lang.js +82 -0
- package/dist/docs.d.ts +64 -0
- package/dist/docs.js +42 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +18 -0
- package/dist/markers.d.ts +11 -0
- package/dist/markers.js +45 -0
- package/dist/ops.d.ts +13 -0
- package/dist/ops.js +22 -0
- package/dist/positions.d.ts +7 -0
- package/dist/positions.js +40 -0
- package/dist/theme.d.ts +16 -0
- package/dist/theme.js +55 -0
- package/dist/types.d.ts +580 -0
- package/dist/types.js +85 -0
- package/errors/E0101.md +43 -0
- package/errors/E0102.md +34 -0
- package/errors/E0103.md +41 -0
- package/errors/E0104.md +5 -0
- package/errors/E0105.md +62 -0
- package/errors/E0106.md +46 -0
- package/errors/E0107.md +48 -0
- package/errors/E0108.md +45 -0
- package/errors/E0109.md +37 -0
- package/errors/E0110.md +17 -0
- package/errors/E0111.md +55 -0
- package/errors/E0112.md +40 -0
- package/errors/E0120.md +34 -0
- package/errors/E0121.md +34 -0
- package/errors/E0122.md +26 -0
- package/errors/E0123.md +37 -0
- package/errors/E0124.md +36 -0
- package/errors/E0125.md +43 -0
- package/errors/E0126.md +38 -0
- package/errors/E0128.md +34 -0
- package/errors/E0129.md +42 -0
- package/errors/E0130.md +43 -0
- package/errors/E0131.md +42 -0
- package/errors/E0132.md +40 -0
- package/errors/E0133.md +46 -0
- package/errors/E0134.md +36 -0
- package/errors/E0135.md +109 -0
- package/errors/E0137.md +37 -0
- package/errors/E0140.md +46 -0
- package/errors/E0141.md +35 -0
- package/errors/E0142.md +38 -0
- package/errors/E0143.md +62 -0
- package/errors/E0144.md +49 -0
- package/errors/E0145.md +48 -0
- package/errors/E0146.md +38 -0
- package/errors/E0147.md +57 -0
- package/errors/E0148.md +42 -0
- package/errors/E0149.md +27 -0
- package/errors/E0150.md +77 -0
- package/errors/E0151.md +47 -0
- package/errors/E0152.md +35 -0
- package/errors/E0201.md +35 -0
- package/errors/E0202.md +42 -0
- package/errors/E0203.md +37 -0
- package/errors/E0204.md +46 -0
- package/errors/E0205.md +47 -0
- package/errors/E0206.md +47 -0
- package/errors/E0208.md +59 -0
- package/errors/E0210.md +44 -0
- package/errors/E0211.md +43 -0
- package/errors/E0212.md +41 -0
- package/errors/E0213.md +42 -0
- package/errors/E0214.md +42 -0
- package/errors/E0215.md +44 -0
- package/errors/E0216.md +41 -0
- package/errors/E0217.md +43 -0
- package/errors/E0218.md +44 -0
- package/errors/E0230.md +46 -0
- package/errors/E0232.md +42 -0
- package/errors/E0233.md +42 -0
- package/errors/E0234.md +43 -0
- package/errors/E0240.md +31 -0
- package/errors/E0242.md +5 -0
- package/errors/E0243.md +5 -0
- package/errors/E0250.md +39 -0
- package/errors/E0251.md +83 -0
- package/errors/E0252.md +42 -0
- package/errors/E0253.md +142 -0
- package/errors/E0254.md +38 -0
- package/errors/E0301.md +43 -0
- package/errors/E0302.md +58 -0
- package/errors/E0303.md +57 -0
- package/errors/E0304.md +9 -0
- package/errors/E0305.md +55 -0
- package/errors/E0307.md +9 -0
- package/errors/E0308.md +9 -0
- package/errors/E0310.md +46 -0
- package/errors/E0311.md +46 -0
- package/errors/E0330.md +67 -0
- package/errors/E0331.md +64 -0
- package/errors/E0332.md +52 -0
- package/errors/E0333.md +61 -0
- package/errors/E0334.md +61 -0
- package/errors/E0335.md +57 -0
- package/errors/E0336.md +50 -0
- package/errors/E0337.md +54 -0
- package/errors/E0338.md +62 -0
- package/errors/E0340.md +57 -0
- package/errors/E0341.md +51 -0
- package/errors/E0342.md +53 -0
- package/errors/E0343.md +56 -0
- package/errors/E0344.md +58 -0
- package/errors/E0345.md +51 -0
- package/errors/E0346.md +45 -0
- package/errors/E0347.md +53 -0
- package/errors/E0348.md +50 -0
- package/errors/E0349.md +52 -0
- package/errors/E0350.md +54 -0
- package/errors/E0351.md +54 -0
- package/errors/E0352.md +60 -0
- package/errors/E0353.md +53 -0
- package/errors/E0354.md +43 -0
- package/errors/E0355.md +55 -0
- package/errors/E0356.md +65 -0
- package/errors/E0357.md +68 -0
- package/errors/E0358.md +50 -0
- package/errors/E0359.md +53 -0
- package/errors/E0360.md +59 -0
- package/errors/E0361.md +59 -0
- package/errors/E0362.md +56 -0
- package/errors/E0364.md +58 -0
- package/errors/E0365.md +58 -0
- package/errors/E0366.md +56 -0
- package/errors/E0367.md +57 -0
- package/errors/E0368.md +58 -0
- package/errors/E0369.md +60 -0
- package/errors/E0370.md +59 -0
- package/errors/E0371.md +59 -0
- package/errors/E0372.md +57 -0
- package/errors/E0380.md +71 -0
- package/errors/E0381.md +61 -0
- package/errors/E0382.md +64 -0
- package/errors/E0383.md +61 -0
- package/errors/E0384.md +63 -0
- package/errors/E0385.md +61 -0
- package/errors/E0386.md +59 -0
- package/errors/E0387.md +59 -0
- package/errors/E0388.md +60 -0
- package/errors/E0389.md +59 -0
- package/errors/E0390.md +59 -0
- package/errors/E0401.md +56 -0
- package/errors/E0402.md +51 -0
- package/errors/E0403.md +51 -0
- package/errors/E0404.md +57 -0
- package/errors/E0405.md +56 -0
- package/errors/E0406.md +53 -0
- package/errors/E0407.md +54 -0
- package/errors/E0410.md +56 -0
- package/errors/E0411.md +59 -0
- package/errors/E0412.md +59 -0
- package/errors/E0413.md +74 -0
- package/errors/E0414.md +53 -0
- package/errors/E0415.md +72 -0
- package/errors/E0416.md +67 -0
- package/errors/E0418.md +59 -0
- package/errors/E0420.md +71 -0
- package/errors/E0421.md +82 -0
- package/errors/E0422.md +82 -0
- package/errors/E0423.md +83 -0
- package/errors/E0501.md +51 -0
- package/errors/E0502.md +50 -0
- package/errors/E0503.md +52 -0
- package/errors/E0504.md +64 -0
- package/errors/E0505.md +51 -0
- package/errors/E0506.md +48 -0
- package/errors/E0507.md +41 -0
- package/errors/E0508.md +39 -0
- package/errors/E0601.md +22 -0
- package/errors/E0602.md +28 -0
- package/errors/E0603.md +65 -0
- package/errors/E0604.md +37 -0
- package/errors/E0605.md +36 -0
- package/errors/E0606.md +44 -0
- package/errors/E0607.md +57 -0
- package/errors/E0608.md +37 -0
- package/errors/E0609.md +33 -0
- package/errors/E0611.md +37 -0
- package/errors/E0612.md +34 -0
- package/errors/E0613.md +30 -0
- package/errors/E0614.md +36 -0
- package/errors/E0616.md +33 -0
- package/errors/E0617.md +15 -0
- package/errors/E0618.md +16 -0
- package/errors/E0620.md +37 -0
- package/errors/E0621.md +45 -0
- package/errors/E0622.md +34 -0
- package/errors/E0623.md +33 -0
- package/errors/E0624.md +34 -0
- package/errors/E0625.md +28 -0
- package/errors/E0626.md +54 -0
- package/errors/E0627.md +27 -0
- package/errors/E0628.md +63 -0
- package/errors/E0701.md +25 -0
- package/errors/E0801.md +23 -0
- package/errors/E0802.md +22 -0
- package/errors/E0803.md +22 -0
- package/errors/E0804.md +25 -0
- package/errors/E0805.md +26 -0
- package/errors/E0901.md +27 -0
- package/errors/E0902.md +40 -0
- package/errors/E0903.md +23 -0
- package/errors/E1001.md +53 -0
- package/errors/E1002.md +43 -0
- package/errors/E1003.md +40 -0
- package/errors/E1004.md +44 -0
- package/errors/README.md +215 -0
- package/package.json +29 -3
package/errors/E0331.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0331: a mapping's key is not a plain field name
|
|
4
|
+
|
|
5
|
+
A mapping's key is a plain field name: the target field it produces. A quoted,
|
|
6
|
+
computed or pattern label is not one.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
b: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ForwardLens: {
|
|
26
|
+
v0_0: _
|
|
27
|
+
v1_0: {
|
|
28
|
+
"\("b")": v0_0.a
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`ship/tip.thema`:
|
|
34
|
+
|
|
35
|
+
```cue
|
|
36
|
+
Schema: {
|
|
37
|
+
b: string
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
thema reports:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
error[E0331]: a mapping's key is a plain field name
|
|
45
|
+
--> history/1.0.thema:8:3
|
|
46
|
+
|
|
|
47
|
+
8 | "\("b")": v0_0.a
|
|
48
|
+
| ^^^^
|
|
49
|
+
|
|
|
50
|
+
|
|
51
|
+
error[E0346]: ForwardLens produces nothing for b, which 1.0 requires: add b: <mapping> to v1_0
|
|
52
|
+
--> history/1.0.thema:5:1
|
|
53
|
+
|
|
|
54
|
+
5 | ForwardLens: {
|
|
55
|
+
| ^^^^^^^^^^^
|
|
56
|
+
|
|
|
57
|
+
|
|
58
|
+
error[E0347]: 0.0 declares a and 1.0 does not, and nothing maps it: write <field>: v0_0.a to move it, or a: _drop
|
|
59
|
+
--> history/1.0.thema:5:1
|
|
60
|
+
|
|
|
61
|
+
5 | ForwardLens: {
|
|
62
|
+
| ^^^^^^^^^^^
|
|
63
|
+
|
|
|
64
|
+
```
|
package/errors/E0332.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0332: a mapping has an attribute
|
|
4
|
+
|
|
5
|
+
Nothing attaches to a mapping. A lacuna is declared in the lens's lacunas
|
|
6
|
+
field, keyed by the mapping it describes, not as an attribute on the mapping.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
firstfield: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
firstfield: string
|
|
23
|
+
secondfield: int
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ForwardLens: {
|
|
27
|
+
v0_0: _
|
|
28
|
+
v1_0: {
|
|
29
|
+
secondfield: -1 @lacuna(Placeholder, "-1 is a placeholder")
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`ship/tip.thema`:
|
|
35
|
+
|
|
36
|
+
```cue
|
|
37
|
+
Schema: {
|
|
38
|
+
firstfield: string
|
|
39
|
+
secondfield: int
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
thema reports:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
error[E0332]: a mapping has no attributes; a lacuna is declared in the lens's lacunas field, keyed by the mapping
|
|
47
|
+
--> history/1.0.thema:9:19
|
|
48
|
+
|
|
|
49
|
+
9 | secondfield: -1 @lacuna(Placeholder, "-1 is a placeholder")
|
|
50
|
+
| ^
|
|
51
|
+
|
|
|
52
|
+
```
|
package/errors/E0333.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0333: a lens body or its lacunas declare a hidden field or a definition
|
|
4
|
+
|
|
5
|
+
A lens maps data fields. A hidden field (_x) or a definition (#X) is not
|
|
6
|
+
data, so a lens body and its lacunas have neither. That also keeps the
|
|
7
|
+
operations, spelled _drop, _coalesce, _match and _each, and _item from ever
|
|
8
|
+
naming a field.
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
`ship/history/0.0.thema`:
|
|
13
|
+
|
|
14
|
+
```cue
|
|
15
|
+
Schema: {
|
|
16
|
+
kind: string
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ship/history/1.0.thema`:
|
|
21
|
+
|
|
22
|
+
```cue
|
|
23
|
+
Schema: {
|
|
24
|
+
kind: "a" | "b"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ForwardLens: {
|
|
28
|
+
v0_0: _
|
|
29
|
+
v1_0: {
|
|
30
|
+
_match: "a"
|
|
31
|
+
kind: _match(v0_0.kind, {"a": "a", [_]: "b"})
|
|
32
|
+
}
|
|
33
|
+
lacunas: {
|
|
34
|
+
kind: [{
|
|
35
|
+
type: LossyFieldMapping
|
|
36
|
+
message: "kinds other than a become b"
|
|
37
|
+
}]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`ship/tip.thema`:
|
|
43
|
+
|
|
44
|
+
```cue
|
|
45
|
+
Schema: {
|
|
46
|
+
kind: "a" | "b"
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
thema reports:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
error[E0333]: the ForwardLens in history/1.0.thema declares _match, a hidden field, which is not data
|
|
54
|
+
--> history/1.0.thema:8:3
|
|
55
|
+
|
|
|
56
|
+
8 | _match: "a"
|
|
57
|
+
| ^^^^^^
|
|
58
|
+
|
|
|
59
|
+
= note: a lens maps data fields, so a key is a field of the target, or of its lacunas, by name
|
|
60
|
+
= help: remove it; to map a field whose name starts with _ or #, quote the key: "_match": ...
|
|
61
|
+
```
|
package/errors/E0334.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0334: a nested body embeds something other than a path into the source instance
|
|
4
|
+
|
|
5
|
+
A nested body may embed a path into the source instance, `{v0_0.meta, x: 1}`,
|
|
6
|
+
to copy the fields found there and add to them. It may embed nothing else.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
meta: {
|
|
15
|
+
owner: string
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ship/history/1.0.thema`:
|
|
21
|
+
|
|
22
|
+
```cue
|
|
23
|
+
Schema: {
|
|
24
|
+
meta: {
|
|
25
|
+
owner: string
|
|
26
|
+
team: string
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ForwardLens: {
|
|
31
|
+
v0_0: _
|
|
32
|
+
v1_0: {
|
|
33
|
+
meta: {
|
|
34
|
+
defaults
|
|
35
|
+
team: "unassigned"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`ship/tip.thema`:
|
|
42
|
+
|
|
43
|
+
```cue
|
|
44
|
+
Schema: {
|
|
45
|
+
meta: {
|
|
46
|
+
owner: string
|
|
47
|
+
team: string
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
thema reports:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
error[E0334]: a nested body may embed only v0_0.<path>, to copy from it
|
|
56
|
+
--> history/1.0.thema:12:4
|
|
57
|
+
|
|
|
58
|
+
12 | defaults
|
|
59
|
+
| ^^^^^^^^
|
|
60
|
+
|
|
|
61
|
+
```
|
package/errors/E0335.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0335: a _coalesce is not _coalesce(source path, fallback)
|
|
4
|
+
|
|
5
|
+
coalesce takes two arguments: a reference into the source instance, and the
|
|
6
|
+
fallback to use when the referenced field is absent.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a?: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
b: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ForwardLens: {
|
|
26
|
+
v0_0: _
|
|
27
|
+
v1_0: {
|
|
28
|
+
b: _coalesce(v0_0.a)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`ship/tip.thema`:
|
|
34
|
+
|
|
35
|
+
```cue
|
|
36
|
+
Schema: {
|
|
37
|
+
b: string
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
thema reports:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
error[E0335]: _coalesce takes two arguments: _coalesce(v0_0.<path>, fallback)
|
|
45
|
+
--> history/1.0.thema:8:6
|
|
46
|
+
|
|
|
47
|
+
8 | b: _coalesce(v0_0.a)
|
|
48
|
+
| ^^^^^^^^^
|
|
49
|
+
|
|
|
50
|
+
|
|
51
|
+
error[E0347]: 0.0 declares a and 1.0 does not, and nothing maps it: write <field>: v0_0.a to move it, or a: _drop
|
|
52
|
+
--> history/1.0.thema:5:1
|
|
53
|
+
|
|
|
54
|
+
5 | ForwardLens: {
|
|
55
|
+
| ^^^^^^^^^^^
|
|
56
|
+
|
|
|
57
|
+
```
|
package/errors/E0336.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0336: a _match is not _match(source path, arms)
|
|
4
|
+
|
|
5
|
+
match takes two arguments: a reference into the source instance, and its
|
|
6
|
+
arms, a struct of `value: value` entries with an optional `[_]` catch-all.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
kind: "a" | "b"
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
kind: 1 | 2
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ForwardLens: {
|
|
26
|
+
v0_0: _
|
|
27
|
+
v1_0: {
|
|
28
|
+
kind: _match(v0_0.kind)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`ship/tip.thema`:
|
|
34
|
+
|
|
35
|
+
```cue
|
|
36
|
+
Schema: {
|
|
37
|
+
kind: 1 | 2
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
thema reports:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
error[E0336]: _match takes two arguments: _match(v0_0.<path>, {...})
|
|
45
|
+
--> history/1.0.thema:8:9
|
|
46
|
+
|
|
|
47
|
+
8 | kind: _match(v0_0.kind)
|
|
48
|
+
| ^^^^^^
|
|
49
|
+
|
|
|
50
|
+
```
|
package/errors/E0337.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0337: an _each is not _each(source list, body)
|
|
4
|
+
|
|
5
|
+
each takes two arguments: a reference to a list in the source instance, and a
|
|
6
|
+
body of mappings over `item`, applied to each element.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
items: [...{
|
|
15
|
+
title: string
|
|
16
|
+
}]
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ship/history/1.0.thema`:
|
|
21
|
+
|
|
22
|
+
```cue
|
|
23
|
+
Schema: {
|
|
24
|
+
items: [...{
|
|
25
|
+
name: string
|
|
26
|
+
}]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ForwardLens: {
|
|
30
|
+
v0_0: _
|
|
31
|
+
v1_0: {
|
|
32
|
+
items: _each(v0_0.items)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`ship/tip.thema`:
|
|
38
|
+
|
|
39
|
+
```cue
|
|
40
|
+
Schema: {
|
|
41
|
+
items: [...{name: string}]
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
thema reports:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
error[E0337]: _each takes two arguments: _each(v0_0.<list>, {...})
|
|
49
|
+
--> history/1.0.thema:10:10
|
|
50
|
+
|
|
|
51
|
+
10 | items: _each(v0_0.items)
|
|
52
|
+
| ^^^^^
|
|
53
|
+
|
|
|
54
|
+
```
|
package/errors/E0338.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0338: a _match's arms are not constant arms with at most one catch-all
|
|
4
|
+
|
|
5
|
+
A match's arms are a struct of `value: value` entries, each matching one
|
|
6
|
+
source constant to one target constant, with at most one `[_]` catch-all arm.
|
|
7
|
+
An arm's value that is not a constant is not one.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
kind: "a" | "b"
|
|
16
|
+
x: int
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ship/history/1.0.thema`:
|
|
21
|
+
|
|
22
|
+
```cue
|
|
23
|
+
Schema: {
|
|
24
|
+
kind: int
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ForwardLens: {
|
|
28
|
+
v0_0: _
|
|
29
|
+
v1_0: {
|
|
30
|
+
kind: _match(v0_0.kind, {
|
|
31
|
+
"a": v0_0.x
|
|
32
|
+
"b": 2
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`ship/tip.thema`:
|
|
39
|
+
|
|
40
|
+
```cue
|
|
41
|
+
Schema: {
|
|
42
|
+
kind: int
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
thema reports:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
error[E0338]: a _match arm's value must be a constant
|
|
50
|
+
--> history/1.0.thema:9:9
|
|
51
|
+
|
|
|
52
|
+
9 | "a": v0_0.x
|
|
53
|
+
| ^^^^
|
|
54
|
+
|
|
|
55
|
+
|
|
56
|
+
error[E0347]: 0.0 declares x and 1.0 does not, and nothing maps it: write <field>: v0_0.x to move it, or x: _drop
|
|
57
|
+
--> history/1.0.thema:5:1
|
|
58
|
+
|
|
|
59
|
+
5 | ForwardLens: {
|
|
60
|
+
| ^^^^^^^^^^^
|
|
61
|
+
|
|
|
62
|
+
```
|
package/errors/E0340.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0340: a lens reads a field its source version does not declare
|
|
4
|
+
|
|
5
|
+
A mapping reads a field its source version does not declare. No instance of the
|
|
6
|
+
source has it, so the lens never has a value to copy.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
b: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ForwardLens: {
|
|
26
|
+
v0_0: _
|
|
27
|
+
v1_0: {
|
|
28
|
+
b: v0_0.nope
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`ship/tip.thema`:
|
|
34
|
+
|
|
35
|
+
```cue
|
|
36
|
+
Schema: {
|
|
37
|
+
b: string
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
thema reports:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
error[E0340]: 0.0 does not declare nope
|
|
45
|
+
--> history/1.0.thema:8:6
|
|
46
|
+
|
|
|
47
|
+
8 | b: v0_0.nope
|
|
48
|
+
| ^^^^
|
|
49
|
+
|
|
|
50
|
+
|
|
51
|
+
error[E0347]: 0.0 declares a and 1.0 does not, and nothing maps it: write <field>: v0_0.a to move it, or a: _drop
|
|
52
|
+
--> history/1.0.thema:5:1
|
|
53
|
+
|
|
|
54
|
+
5 | ForwardLens: {
|
|
55
|
+
| ^^^^^^^^^^^
|
|
56
|
+
|
|
|
57
|
+
```
|
package/errors/E0341.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0341: a lens maps a field its target version does not declare
|
|
4
|
+
|
|
5
|
+
A mapping produces a field its target version does not declare. A lens writes
|
|
6
|
+
only what its target declares, however open the author wrote the schema.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
b: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ForwardLens: {
|
|
26
|
+
v0_0: _
|
|
27
|
+
v1_0: {
|
|
28
|
+
b: v0_0.a
|
|
29
|
+
nope: v0_0.a
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`ship/tip.thema`:
|
|
35
|
+
|
|
36
|
+
```cue
|
|
37
|
+
Schema: {
|
|
38
|
+
b: string
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
thema reports:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
error[E0341]: 1.0 does not declare nope
|
|
46
|
+
--> history/1.0.thema:9:3
|
|
47
|
+
|
|
|
48
|
+
9 | nope: v0_0.a
|
|
49
|
+
| ^^^^
|
|
50
|
+
|
|
|
51
|
+
```
|
package/errors/E0342.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0342: a lens drops a field its target version requires
|
|
4
|
+
|
|
5
|
+
A drop says a source field has no place in the target. Where the target
|
|
6
|
+
requires a field of that name, dropping it would leave a required field absent.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
a: string
|
|
23
|
+
b: int
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ForwardLens: {
|
|
27
|
+
v0_0: _
|
|
28
|
+
v1_0: {
|
|
29
|
+
a: _drop
|
|
30
|
+
b: 1
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`ship/tip.thema`:
|
|
36
|
+
|
|
37
|
+
```cue
|
|
38
|
+
Schema: {
|
|
39
|
+
a: string
|
|
40
|
+
b: int
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
thema reports:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
error[E0342]: 1.0 requires a; dropping it would leave it absent
|
|
48
|
+
--> history/1.0.thema:9:3
|
|
49
|
+
|
|
|
50
|
+
9 | a: _drop
|
|
51
|
+
| ^
|
|
52
|
+
|
|
|
53
|
+
```
|
package/errors/E0343.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0343: a lens moves an optional field to a required one with no fallback
|
|
4
|
+
|
|
5
|
+
A field optional in the source and required in the target cannot simply be
|
|
6
|
+
copied: an instance that lacks it would have nothing to put there. coalesce says
|
|
7
|
+
what to use when it is absent.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
a: string
|
|
16
|
+
b?: int
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ship/history/1.0.thema`:
|
|
21
|
+
|
|
22
|
+
```cue
|
|
23
|
+
Schema: {
|
|
24
|
+
a: string
|
|
25
|
+
b: int
|
|
26
|
+
c: bool
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ForwardLens: {
|
|
30
|
+
v0_0: _
|
|
31
|
+
v1_0: {
|
|
32
|
+
c: true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`ship/tip.thema`:
|
|
38
|
+
|
|
39
|
+
```cue
|
|
40
|
+
Schema: {
|
|
41
|
+
a: string
|
|
42
|
+
b: int
|
|
43
|
+
c: bool
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
thema reports:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
error[E0343]: b is optional in 0.0 and required in 1.0: write b: _coalesce(v0_0.b, <fallback>) to say what to use when it is absent
|
|
51
|
+
--> history/1.0.thema:3:2
|
|
52
|
+
|
|
|
53
|
+
3 | b: int
|
|
54
|
+
| ^
|
|
55
|
+
|
|
|
56
|
+
```
|