@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.
Files changed (225) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +24 -1
  3. package/dist/Diagnostics.d.ts +8 -0
  4. package/dist/Diagnostics.js +14 -0
  5. package/dist/Editor.d.ts +12 -0
  6. package/dist/Editor.js +95 -0
  7. package/dist/OpBar.d.ts +14 -0
  8. package/dist/OpBar.js +15 -0
  9. package/dist/Output.d.ts +20 -0
  10. package/dist/Output.js +56 -0
  11. package/dist/Tabs.d.ts +15 -0
  12. package/dist/Tabs.js +23 -0
  13. package/dist/cue-lang.d.ts +8 -0
  14. package/dist/cue-lang.js +82 -0
  15. package/dist/docs.d.ts +64 -0
  16. package/dist/docs.js +42 -0
  17. package/dist/index.d.ts +12 -0
  18. package/dist/index.js +18 -0
  19. package/dist/markers.d.ts +11 -0
  20. package/dist/markers.js +45 -0
  21. package/dist/ops.d.ts +13 -0
  22. package/dist/ops.js +22 -0
  23. package/dist/positions.d.ts +7 -0
  24. package/dist/positions.js +40 -0
  25. package/dist/theme.d.ts +16 -0
  26. package/dist/theme.js +55 -0
  27. package/dist/types.d.ts +580 -0
  28. package/dist/types.js +85 -0
  29. package/errors/E0101.md +43 -0
  30. package/errors/E0102.md +34 -0
  31. package/errors/E0103.md +41 -0
  32. package/errors/E0104.md +5 -0
  33. package/errors/E0105.md +62 -0
  34. package/errors/E0106.md +46 -0
  35. package/errors/E0107.md +48 -0
  36. package/errors/E0108.md +45 -0
  37. package/errors/E0109.md +37 -0
  38. package/errors/E0110.md +17 -0
  39. package/errors/E0111.md +55 -0
  40. package/errors/E0112.md +40 -0
  41. package/errors/E0120.md +34 -0
  42. package/errors/E0121.md +34 -0
  43. package/errors/E0122.md +26 -0
  44. package/errors/E0123.md +37 -0
  45. package/errors/E0124.md +36 -0
  46. package/errors/E0125.md +43 -0
  47. package/errors/E0126.md +38 -0
  48. package/errors/E0128.md +34 -0
  49. package/errors/E0129.md +42 -0
  50. package/errors/E0130.md +43 -0
  51. package/errors/E0131.md +42 -0
  52. package/errors/E0132.md +40 -0
  53. package/errors/E0133.md +46 -0
  54. package/errors/E0134.md +36 -0
  55. package/errors/E0135.md +109 -0
  56. package/errors/E0137.md +37 -0
  57. package/errors/E0140.md +46 -0
  58. package/errors/E0141.md +35 -0
  59. package/errors/E0142.md +38 -0
  60. package/errors/E0143.md +62 -0
  61. package/errors/E0144.md +49 -0
  62. package/errors/E0145.md +48 -0
  63. package/errors/E0146.md +38 -0
  64. package/errors/E0147.md +57 -0
  65. package/errors/E0148.md +42 -0
  66. package/errors/E0149.md +27 -0
  67. package/errors/E0150.md +77 -0
  68. package/errors/E0151.md +47 -0
  69. package/errors/E0152.md +35 -0
  70. package/errors/E0201.md +35 -0
  71. package/errors/E0202.md +42 -0
  72. package/errors/E0203.md +37 -0
  73. package/errors/E0204.md +46 -0
  74. package/errors/E0205.md +47 -0
  75. package/errors/E0206.md +47 -0
  76. package/errors/E0208.md +59 -0
  77. package/errors/E0210.md +44 -0
  78. package/errors/E0211.md +43 -0
  79. package/errors/E0212.md +41 -0
  80. package/errors/E0213.md +42 -0
  81. package/errors/E0214.md +42 -0
  82. package/errors/E0215.md +44 -0
  83. package/errors/E0216.md +41 -0
  84. package/errors/E0217.md +43 -0
  85. package/errors/E0218.md +44 -0
  86. package/errors/E0230.md +46 -0
  87. package/errors/E0232.md +42 -0
  88. package/errors/E0233.md +42 -0
  89. package/errors/E0234.md +43 -0
  90. package/errors/E0240.md +31 -0
  91. package/errors/E0242.md +5 -0
  92. package/errors/E0243.md +5 -0
  93. package/errors/E0250.md +39 -0
  94. package/errors/E0251.md +83 -0
  95. package/errors/E0252.md +42 -0
  96. package/errors/E0253.md +142 -0
  97. package/errors/E0254.md +38 -0
  98. package/errors/E0301.md +43 -0
  99. package/errors/E0302.md +58 -0
  100. package/errors/E0303.md +57 -0
  101. package/errors/E0304.md +9 -0
  102. package/errors/E0305.md +55 -0
  103. package/errors/E0307.md +9 -0
  104. package/errors/E0308.md +9 -0
  105. package/errors/E0310.md +46 -0
  106. package/errors/E0311.md +46 -0
  107. package/errors/E0330.md +67 -0
  108. package/errors/E0331.md +64 -0
  109. package/errors/E0332.md +52 -0
  110. package/errors/E0333.md +61 -0
  111. package/errors/E0334.md +61 -0
  112. package/errors/E0335.md +57 -0
  113. package/errors/E0336.md +50 -0
  114. package/errors/E0337.md +54 -0
  115. package/errors/E0338.md +62 -0
  116. package/errors/E0340.md +57 -0
  117. package/errors/E0341.md +51 -0
  118. package/errors/E0342.md +53 -0
  119. package/errors/E0343.md +56 -0
  120. package/errors/E0344.md +58 -0
  121. package/errors/E0345.md +51 -0
  122. package/errors/E0346.md +45 -0
  123. package/errors/E0347.md +53 -0
  124. package/errors/E0348.md +50 -0
  125. package/errors/E0349.md +52 -0
  126. package/errors/E0350.md +54 -0
  127. package/errors/E0351.md +54 -0
  128. package/errors/E0352.md +60 -0
  129. package/errors/E0353.md +53 -0
  130. package/errors/E0354.md +43 -0
  131. package/errors/E0355.md +55 -0
  132. package/errors/E0356.md +65 -0
  133. package/errors/E0357.md +68 -0
  134. package/errors/E0358.md +50 -0
  135. package/errors/E0359.md +53 -0
  136. package/errors/E0360.md +59 -0
  137. package/errors/E0361.md +59 -0
  138. package/errors/E0362.md +56 -0
  139. package/errors/E0364.md +58 -0
  140. package/errors/E0365.md +58 -0
  141. package/errors/E0366.md +56 -0
  142. package/errors/E0367.md +57 -0
  143. package/errors/E0368.md +58 -0
  144. package/errors/E0369.md +60 -0
  145. package/errors/E0370.md +59 -0
  146. package/errors/E0371.md +59 -0
  147. package/errors/E0372.md +57 -0
  148. package/errors/E0380.md +71 -0
  149. package/errors/E0381.md +61 -0
  150. package/errors/E0382.md +64 -0
  151. package/errors/E0383.md +61 -0
  152. package/errors/E0384.md +63 -0
  153. package/errors/E0385.md +61 -0
  154. package/errors/E0386.md +59 -0
  155. package/errors/E0387.md +59 -0
  156. package/errors/E0388.md +60 -0
  157. package/errors/E0389.md +59 -0
  158. package/errors/E0390.md +59 -0
  159. package/errors/E0401.md +56 -0
  160. package/errors/E0402.md +51 -0
  161. package/errors/E0403.md +51 -0
  162. package/errors/E0404.md +57 -0
  163. package/errors/E0405.md +56 -0
  164. package/errors/E0406.md +53 -0
  165. package/errors/E0407.md +54 -0
  166. package/errors/E0410.md +56 -0
  167. package/errors/E0411.md +59 -0
  168. package/errors/E0412.md +59 -0
  169. package/errors/E0413.md +74 -0
  170. package/errors/E0414.md +53 -0
  171. package/errors/E0415.md +72 -0
  172. package/errors/E0416.md +67 -0
  173. package/errors/E0418.md +59 -0
  174. package/errors/E0420.md +71 -0
  175. package/errors/E0421.md +82 -0
  176. package/errors/E0422.md +82 -0
  177. package/errors/E0423.md +83 -0
  178. package/errors/E0501.md +51 -0
  179. package/errors/E0502.md +50 -0
  180. package/errors/E0503.md +52 -0
  181. package/errors/E0504.md +64 -0
  182. package/errors/E0505.md +51 -0
  183. package/errors/E0506.md +48 -0
  184. package/errors/E0507.md +41 -0
  185. package/errors/E0508.md +39 -0
  186. package/errors/E0601.md +22 -0
  187. package/errors/E0602.md +28 -0
  188. package/errors/E0603.md +65 -0
  189. package/errors/E0604.md +37 -0
  190. package/errors/E0605.md +36 -0
  191. package/errors/E0606.md +44 -0
  192. package/errors/E0607.md +57 -0
  193. package/errors/E0608.md +37 -0
  194. package/errors/E0609.md +33 -0
  195. package/errors/E0611.md +37 -0
  196. package/errors/E0612.md +34 -0
  197. package/errors/E0613.md +30 -0
  198. package/errors/E0614.md +36 -0
  199. package/errors/E0616.md +33 -0
  200. package/errors/E0617.md +15 -0
  201. package/errors/E0618.md +16 -0
  202. package/errors/E0620.md +37 -0
  203. package/errors/E0621.md +45 -0
  204. package/errors/E0622.md +34 -0
  205. package/errors/E0623.md +33 -0
  206. package/errors/E0624.md +34 -0
  207. package/errors/E0625.md +28 -0
  208. package/errors/E0626.md +54 -0
  209. package/errors/E0627.md +27 -0
  210. package/errors/E0628.md +63 -0
  211. package/errors/E0701.md +25 -0
  212. package/errors/E0801.md +23 -0
  213. package/errors/E0802.md +22 -0
  214. package/errors/E0803.md +22 -0
  215. package/errors/E0804.md +25 -0
  216. package/errors/E0805.md +26 -0
  217. package/errors/E0901.md +27 -0
  218. package/errors/E0902.md +40 -0
  219. package/errors/E0903.md +23 -0
  220. package/errors/E1001.md +53 -0
  221. package/errors/E1002.md +43 -0
  222. package/errors/E1003.md +40 -0
  223. package/errors/E1004.md +44 -0
  224. package/errors/README.md +215 -0
  225. package/package.json +29 -3
@@ -0,0 +1,580 @@
1
+ /**
2
+ * File is one named text: a file of the authoring form, relative to the
3
+ * lineage's directory (tip.thema, history/0.0.thema), or a normal-form .cue
4
+ * file.
5
+ */
6
+ export interface File {
7
+ path: string;
8
+ text: string;
9
+ }
10
+ /**
11
+ * LineageInput is a lineage as the author wrote it, in exactly one of the two
12
+ * forms: the authoring form (Name and Files) or one normal-form file (Normal,
13
+ * with Path naming the lineage within it when it is not the file's root).
14
+ */
15
+ export interface LineageInput {
16
+ /**
17
+ * Name is the lineage's name in the authoring form, which the authoring
18
+ * form takes from its directory.
19
+ */
20
+ name?: string;
21
+ files?: File[];
22
+ /**
23
+ * Normal is a normal-form file. It may import github.com/sdboyer/thema,
24
+ * and nothing else.
25
+ */
26
+ normal?: File;
27
+ /**
28
+ * Path is the CUE path of the lineage within Normal, such as "lin" or
29
+ * "rename.l". Empty means the file's root.
30
+ */
31
+ path?: string;
32
+ }
33
+ /**
34
+ * DataInput is one data document.
35
+ */
36
+ export interface DataInput {
37
+ /**
38
+ * Filename names the document in diagnostics. It must not end in .cue.
39
+ */
40
+ filename: string;
41
+ text: string;
42
+ /**
43
+ * Format is "json" or "yaml". Empty detects it: JSON first, then YAML.
44
+ */
45
+ format?: string;
46
+ }
47
+ /**
48
+ * Result is what every response carries: whether the operation succeeded,
49
+ * and everything thema had to say about it. OK is false exactly when some
50
+ * diagnostic is an error.
51
+ */
52
+ export interface Result {
53
+ ok: boolean;
54
+ diagnostics: Diagnostic[];
55
+ }
56
+ /**
57
+ * InitResponse describes the playground: the versions it was built from and
58
+ * the operations it answers.
59
+ */
60
+ export interface InitResponse extends Result {
61
+ themaVersion: string;
62
+ cueVersion: string;
63
+ ops: string[];
64
+ }
65
+ /**
66
+ * BindRequest binds a lineage.
67
+ */
68
+ export interface BindRequest {
69
+ lineage: LineageInput;
70
+ }
71
+ /**
72
+ * BindResponse is a bound lineage: its name, its versions in order, and its
73
+ * normal form as text (for the authoring form, what the files compile to).
74
+ * The playground binds a lineage in the authoring form with its tip, on the
75
+ * development path: the tip is the file being edited, and binding the
76
+ * history alone would ignore every edit. Tip describes it, and the
77
+ * diagnostics carry a warning (E1001) for each lens the tip's edge lacks.
78
+ */
79
+ export interface BindResponse extends Result {
80
+ name?: string;
81
+ versions?: string[];
82
+ normal?: string;
83
+ tip?: TipInfo;
84
+ }
85
+ /**
86
+ * TipInfo describes the tip of a lineage in the authoring form.
87
+ */
88
+ export interface TipInfo {
89
+ /**
90
+ * Version is the version the tip cuts as, derived by the compatibility
91
+ * check against the newest version under history/; when the tip is
92
+ * clean, the newest version, which it equals.
93
+ */
94
+ version: string;
95
+ /**
96
+ * Clean says whether the tip equals the newest version under history/,
97
+ * with no lenses: there is nothing to cut.
98
+ */
99
+ clean: boolean;
100
+ /**
101
+ * Provisional says whether the lineage's versions end with the tip's:
102
+ * it is not clean, and an instance of that version is an instance of the
103
+ * tip, not of a version that was cut.
104
+ */
105
+ provisional: boolean;
106
+ }
107
+ /**
108
+ * ValidateRequest validates a data document against one schema. An empty
109
+ * Version means the latest.
110
+ */
111
+ export interface ValidateRequest {
112
+ lineage: LineageInput;
113
+ data: DataInput;
114
+ version?: string;
115
+ }
116
+ /**
117
+ * ValidateResponse names the version the data was validated against.
118
+ */
119
+ export interface ValidateResponse extends Result {
120
+ version?: string;
121
+ }
122
+ /**
123
+ * ValidateAnyRequest searches the lineage for a schema the data is an
124
+ * instance of.
125
+ */
126
+ export interface ValidateAnyRequest {
127
+ lineage: LineageInput;
128
+ data: DataInput;
129
+ }
130
+ /**
131
+ * VersionDiagnostics is what one schema said about the data.
132
+ */
133
+ export interface VersionDiagnostics {
134
+ version: string;
135
+ diagnostics: Diagnostic[];
136
+ }
137
+ /**
138
+ * ValidateAnyResponse names the version that accepted the data, if one did,
139
+ * and what every schema said about it, so that a failure shows why each
140
+ * version refused it.
141
+ */
142
+ export interface ValidateAnyResponse extends Result {
143
+ version?: string;
144
+ perVersion: VersionDiagnostics[];
145
+ }
146
+ /**
147
+ * TranslateRequest translates a data document from one version to another.
148
+ * An empty From searches the lineage for the data's schema.
149
+ */
150
+ export interface TranslateRequest {
151
+ lineage: LineageInput;
152
+ data: DataInput;
153
+ from?: string;
154
+ to: string;
155
+ }
156
+ /**
157
+ * TranslateResponse is the translated instance, as JSON, and the lacunas each
158
+ * step emitted. From and To are versions, except that the tip's provisional
159
+ * version is "tip", and CutsAs then gives the version it cuts as; CutsAs is
160
+ * omitted when the translation does not involve the tip.
161
+ */
162
+ export interface TranslateResponse extends Result {
163
+ from?: string;
164
+ to?: string;
165
+ cutsAs?: string;
166
+ output?: unknown;
167
+ lacunas?: TranslationLacunas;
168
+ }
169
+ /**
170
+ * CodegenRequest generates code from one schema. An empty Version means the
171
+ * latest. Format is "json" or "yaml" for OpenAPI and JSON Schema, and is
172
+ * ignored for TypeScript.
173
+ */
174
+ export interface CodegenRequest {
175
+ lineage: LineageInput;
176
+ version?: string;
177
+ format?: string;
178
+ }
179
+ /**
180
+ * CodegenResponse is the generated text.
181
+ */
182
+ export interface CodegenResponse extends Result {
183
+ version?: string;
184
+ output?: string;
185
+ }
186
+ /**
187
+ * CompileRequest compiles authoring files to the normal form, with the tip,
188
+ * as the playground binds them.
189
+ */
190
+ export interface CompileRequest {
191
+ name: string;
192
+ files: File[];
193
+ }
194
+ /**
195
+ * CompileResponse is the normal form as text.
196
+ */
197
+ export interface CompileResponse extends Result {
198
+ normal?: string;
199
+ }
200
+ /**
201
+ * DecompileRequest recovers the authoring files of a normal-form lineage.
202
+ */
203
+ export interface DecompileRequest {
204
+ normal: File;
205
+ path?: string;
206
+ }
207
+ /**
208
+ * DecompileResponse is the lineage's name and its files: its versions under
209
+ * history/, and a clean tip.
210
+ */
211
+ export interface DecompileResponse extends Result {
212
+ name?: string;
213
+ files?: File[];
214
+ }
215
+ /**
216
+ * FormatRequest lays out one file of the authoring form in its layout.
217
+ */
218
+ export interface FormatRequest {
219
+ file: File;
220
+ }
221
+ /**
222
+ * FormatResponse is the formatted text.
223
+ */
224
+ export interface FormatResponse extends Result {
225
+ text?: string;
226
+ }
227
+ /**
228
+ * ExampleInfo describes one example the playground offers.
229
+ */
230
+ export interface ExampleInfo {
231
+ id: string;
232
+ title: string;
233
+ category: string;
234
+ summary: string;
235
+ /**
236
+ * Kind is the form the example is written in: "authoring" or "normal".
237
+ */
238
+ kind: string;
239
+ /**
240
+ * Binds says whether the lineage binds; an example of an error does not.
241
+ */
242
+ binds: boolean;
243
+ }
244
+ /**
245
+ * ListExamplesResponse lists the examples.
246
+ */
247
+ export interface ListExamplesResponse extends Result {
248
+ examples: ExampleInfo[];
249
+ }
250
+ /**
251
+ * GetExampleRequest asks for one example by ID.
252
+ */
253
+ export interface GetExampleRequest {
254
+ id: string;
255
+ }
256
+ /**
257
+ * GetExampleResponse is an example's lineage and data documents.
258
+ */
259
+ export interface GetExampleResponse extends Result {
260
+ example: ExampleInfo;
261
+ lineage: LineageInput;
262
+ data: DataInput[];
263
+ }
264
+ /**
265
+ * RegisterExamplesRequest adds a host's own examples to thema's, for a
266
+ * deployment of the playground that offers lineages of its own. The examples
267
+ * and example operations then serve both, thema's first. It replaces the
268
+ * examples any earlier request registered.
269
+ */
270
+ export interface RegisterExamplesRequest {
271
+ examples: HostExample[];
272
+ }
273
+ /**
274
+ * HostExample is one example a host supplies, in the shape the example
275
+ * operation returns it. Its ID must be unique among all the examples, and its
276
+ * category must not be one of thema's own. An empty Kind is taken from the
277
+ * lineage's form; a Kind given must name that form. Binds is checked by
278
+ * binding the lineage. Data is offered with the example as it is given.
279
+ */
280
+ export interface HostExample {
281
+ example: ExampleInfo;
282
+ lineage: LineageInput;
283
+ data?: DataInput[];
284
+ }
285
+ /**
286
+ * RegisterExamplesResponse lists the IDs of the examples registered, in the
287
+ * request's order. Each example refused has an error diagnostic saying why;
288
+ * the others are registered regardless.
289
+ */
290
+ export interface RegisterExamplesResponse extends Result {
291
+ registered: string[];
292
+ }
293
+ /**
294
+ * AddrKind says what construct an Address names.
295
+ */
296
+ export type AddrKind = string;
297
+ export declare const AddrLineage: AddrKind;
298
+ export declare const AddrName: AddrKind;
299
+ export declare const AddrJoinSchema: AddrKind;
300
+ export declare const AddrSchema: AddrKind;
301
+ export declare const AddrSchemaField: AddrKind;
302
+ export declare const AddrExample: AddrKind;
303
+ export declare const AddrLens: AddrKind;
304
+ export declare const AddrLensInput: AddrKind;
305
+ export declare const AddrLensResult: AddrKind;
306
+ export declare const AddrLensResultField: AddrKind;
307
+ export declare const AddrLacuna: AddrKind;
308
+ export declare const AddrLacunaField: AddrKind;
309
+ export declare const AddrStep: AddrKind;
310
+ export declare const AddrData: AddrKind;
311
+ /**
312
+ * Version is a syntactic version as an Address carries it. It is a pair rather
313
+ * than thema.SyntacticVersion because diag must not import the thema root.
314
+ */
315
+ export type Version = number[];
316
+ /**
317
+ * Address is the structured subject of a Diagnostic, in terms independent of
318
+ * how the lineage was written. A Vocabulary renders it into the author's.
319
+ */
320
+ export interface Address {
321
+ kind: AddrKind;
322
+ version?: Version;
323
+ from?: Version;
324
+ to?: Version;
325
+ /**
326
+ * Index is a lacuna's or a translation step's index.
327
+ */
328
+ index?: number;
329
+ /**
330
+ * Field is a path inside a schema, a lens result or the data.
331
+ */
332
+ field?: string[];
333
+ /**
334
+ * Name is an example's name, a lacuna field's name, or an unknown field.
335
+ */
336
+ name?: string;
337
+ }
338
+ /**
339
+ * Severity is how seriously a Diagnostic is to be taken.
340
+ */
341
+ export type Severity = string;
342
+ /**
343
+ * SeverityError: the operation failed. A lineage with an error does not bind; data
344
+ * with an error is not an instance.
345
+ */
346
+ export declare const SeverityError: Severity;
347
+ /**
348
+ * SeverityWarning: the operation succeeded, but the author should look.
349
+ */
350
+ export declare const SeverityWarning: Severity;
351
+ /**
352
+ * SeverityNote: information with no judgment attached.
353
+ */
354
+ export declare const SeverityNote: Severity;
355
+ /**
356
+ * Origin says whose text a position points into.
357
+ */
358
+ export type Origin = string;
359
+ /**
360
+ * OriginUser: a file the author wrote, or data they supplied.
361
+ */
362
+ export declare const OriginUser: Origin;
363
+ /**
364
+ * OriginThema: thema's own CUE. Never the author's line.
365
+ */
366
+ export declare const OriginThema: Origin;
367
+ /**
368
+ * OriginSynth: a position with no file behind it, such as a value built
369
+ * in Go without a filename.
370
+ */
371
+ export declare const OriginSynth: Origin;
372
+ /**
373
+ * Code identifies a diagnostic's meaning, stably: E0304 always means the same
374
+ * thing, and a retired code is never reused. Codes are grouped by hundreds;
375
+ * see [Codes].
376
+ */
377
+ export type Code = string;
378
+ /**
379
+ * MaxHeadline is the longest a headline may be. A longer statement is split: a
380
+ * shorter headline names the rule and the construct, and the statement becomes
381
+ * a note.
382
+ */
383
+ export declare const MaxHeadline = 140;
384
+ /**
385
+ * Pos is a position in a file. Line and Col are 1-based; Col counts bytes, as
386
+ * CUE reports it.
387
+ */
388
+ export interface Pos {
389
+ file: string;
390
+ line: number;
391
+ col: number;
392
+ offset?: number;
393
+ origin: Origin;
394
+ }
395
+ /**
396
+ * Span is a range in one file, from Start up to but not including End.
397
+ */
398
+ export interface Span {
399
+ start: Pos;
400
+ end: Pos;
401
+ }
402
+ /**
403
+ * Note is a supporting statement, optionally anchored at a position.
404
+ */
405
+ export interface Note {
406
+ pos?: Pos;
407
+ label: string;
408
+ }
409
+ /**
410
+ * Fix is a machine-applicable edit that resolves the diagnostic.
411
+ */
412
+ export interface Fix {
413
+ span: Span;
414
+ replacement: string;
415
+ }
416
+ /**
417
+ * Diagnostic is one thing thema has to say about an input.
418
+ */
419
+ export interface Diagnostic {
420
+ code: Code;
421
+ severity: Severity;
422
+ /**
423
+ * Headline names the rule and what violates it, in the author's vocabulary.
424
+ */
425
+ headline: string;
426
+ /**
427
+ * Path locates the subject in the author's vocabulary, rendered from
428
+ * Address by a Vocabulary.
429
+ */
430
+ path?: string[];
431
+ /**
432
+ * Address is the structured subject, in terms independent of how the
433
+ * lineage was written.
434
+ */
435
+ address?: Address;
436
+ /**
437
+ * Primary is the author's position, or nil when none could be found.
438
+ */
439
+ primary?: Pos;
440
+ /**
441
+ * Notes say why, and where else to look.
442
+ */
443
+ notes?: Note[];
444
+ /**
445
+ * Help says what to do.
446
+ */
447
+ help?: string[];
448
+ /**
449
+ * Fix is an edit that resolves the diagnostic, when thema knows one.
450
+ */
451
+ fix?: Fix;
452
+ /**
453
+ * Detail is supporting text that is not thema's own, such as CUE's
454
+ * message verbatim.
455
+ */
456
+ detail?: string;
457
+ }
458
+ /**
459
+ * Report is what a tool emits: the diagnostics of one operation.
460
+ */
461
+ export interface Report {
462
+ diagnostics: Diagnostic[];
463
+ summary: Summary;
464
+ }
465
+ /**
466
+ * Summary counts a Report's diagnostics by severity.
467
+ */
468
+ export interface Summary {
469
+ errors: number;
470
+ warnings: number;
471
+ notes: number;
472
+ }
473
+ /**
474
+ * TranslationLacunas holds the lacunas emitted by a translation, step by step.
475
+ * A translation between non-adjacent schemas passes through each intermediate
476
+ * schema. Each step's lacunas are expressed in that step's terms: field paths
477
+ * refer to the step's source and target schemas, and are not re-mapped through
478
+ * later steps.
479
+ */
480
+ export type TranslationLacunas = TranslationStep[];
481
+ /**
482
+ * TranslationStep is a single step of a translation, between adjacent schemas,
483
+ * and the lacunas emitted by that step.
484
+ */
485
+ export interface TranslationStep {
486
+ from: SyntacticVersion;
487
+ to: SyntacticVersion;
488
+ lacunas: Lacuna[];
489
+ }
490
+ /**
491
+ * SyntacticVersion is the position of a schema within a lineage: the index of
492
+ * the schema's sequence within the lineage, then the index of the schema within
493
+ * that sequence.
494
+ * It duplicates thema.SyntacticVersion, which this package cannot import
495
+ * without depending on CUE. The two have the same underlying type, so each
496
+ * converts to the other.
497
+ */
498
+ export type SyntacticVersion = number[];
499
+ /**
500
+ * A Lacuna represents a semantic gap in a Lens's mapping between schemas.
501
+ * For any given mapping between schema, there may exist some valid values and
502
+ * intended semantics on either side that are impossible to precisely translate.
503
+ * When such gaps occur, and an actual schema instance falls into such a gap,
504
+ * the Lens is expected to emit Lacuna that describe the general nature of the
505
+ * translation gap.
506
+ * The production of a lacuna as the output of the translation of a particular
507
+ * instance indicates the lacuna applies to that specific translation.
508
+ */
509
+ export interface Lacuna {
510
+ /**
511
+ * The fields in the pre-translation instance that are relevant to the lacuna.
512
+ */
513
+ sourceFields?: FieldRef[];
514
+ /**
515
+ * The fields in the post-translation instance that are relevant to the lacuna.
516
+ */
517
+ targetFields?: FieldRef[];
518
+ /**
519
+ * The kind of gap.
520
+ */
521
+ type: Type;
522
+ /**
523
+ * A human-readable message describing the gap in translation.
524
+ */
525
+ message: string;
526
+ }
527
+ /**
528
+ * Type identifies a kind of gap a lacuna can describe. The types are
529
+ * defined, and documented, in thema's CUE (LacunaTypes in lacuna.cue).
530
+ */
531
+ export type Type = string;
532
+ /**
533
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
534
+ * each means.
535
+ */
536
+ export declare const Placeholder: Type;
537
+ /**
538
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
539
+ * each means.
540
+ */
541
+ export declare const DroppedField: Type;
542
+ /**
543
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
544
+ * each means.
545
+ */
546
+ export declare const LossyFieldMapping: Type;
547
+ /**
548
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
549
+ * each means.
550
+ */
551
+ export declare const ChangedDefault: Type;
552
+ /**
553
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
554
+ * each means.
555
+ */
556
+ export declare const PrecisionLoss: Type;
557
+ /**
558
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
559
+ * each means.
560
+ */
561
+ export declare const AmbiguousMapping: Type;
562
+ /**
563
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
564
+ * each means.
565
+ */
566
+ export declare const Defaulted: Type;
567
+ /**
568
+ * FieldRef identifies a field in an instance being translated, and its value at
569
+ * the time of translation.
570
+ */
571
+ export interface FieldRef {
572
+ /**
573
+ * Path to the field, in CUE path syntax.
574
+ */
575
+ path: string;
576
+ /**
577
+ * The value of the field at the time of translation.
578
+ */
579
+ value: any;
580
+ }
package/dist/types.js ADDED
@@ -0,0 +1,85 @@
1
+ // Code generated by playground/tsapi from playground/types.go, diag and lacuna. DO NOT EDIT.
2
+ //
3
+ // The playground's wire format: what each operation of the wasm bridge takes
4
+ // and returns, as JSON.
5
+ export const AddrLineage = "lineage";
6
+ export const AddrName = "name";
7
+ export const AddrJoinSchema = "joinSchema";
8
+ export const AddrSchema = "schema"; // Version
9
+ export const AddrSchemaField = "schemaField"; // Version, Field
10
+ export const AddrExample = "example"; // Version, Name
11
+ export const AddrLens = "lens"; // From, To
12
+ export const AddrLensInput = "lensInput"; // From, To
13
+ export const AddrLensResult = "lensResult"; // From, To
14
+ export const AddrLensResultField = "lensResultField"; // From, To, Field
15
+ export const AddrLacuna = "lacuna"; // From, To, Index (or Field for keyed lacunas)
16
+ export const AddrLacunaField = "lacunaField"; // From, To, Index, Name
17
+ export const AddrStep = "step"; // From, To, Index: one step of a translation
18
+ export const AddrData = "data"; // Field
19
+ /**
20
+ * SeverityError: the operation failed. A lineage with an error does not bind; data
21
+ * with an error is not an instance.
22
+ */
23
+ export const SeverityError = "error";
24
+ /**
25
+ * SeverityWarning: the operation succeeded, but the author should look.
26
+ */
27
+ export const SeverityWarning = "warning";
28
+ /**
29
+ * SeverityNote: information with no judgment attached.
30
+ */
31
+ export const SeverityNote = "note";
32
+ /**
33
+ * OriginUser: a file the author wrote, or data they supplied.
34
+ */
35
+ export const OriginUser = "user";
36
+ /**
37
+ * OriginThema: thema's own CUE. Never the author's line.
38
+ */
39
+ export const OriginThema = "thema";
40
+ /**
41
+ * OriginSynth: a position with no file behind it, such as a value built
42
+ * in Go without a filename.
43
+ */
44
+ export const OriginSynth = "synth";
45
+ /**
46
+ * MaxHeadline is the longest a headline may be. A longer statement is split: a
47
+ * shorter headline names the rule and the construct, and the statement becomes
48
+ * a note.
49
+ */
50
+ export const MaxHeadline = 140;
51
+ /**
52
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
53
+ * each means.
54
+ */
55
+ export const Placeholder = "Placeholder";
56
+ /**
57
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
58
+ * each means.
59
+ */
60
+ export const DroppedField = "DroppedField";
61
+ /**
62
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
63
+ * each means.
64
+ */
65
+ export const LossyFieldMapping = "LossyFieldMapping";
66
+ /**
67
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
68
+ * each means.
69
+ */
70
+ export const ChangedDefault = "ChangedDefault";
71
+ /**
72
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
73
+ * each means.
74
+ */
75
+ export const PrecisionLoss = "PrecisionLoss";
76
+ /**
77
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
78
+ * each means.
79
+ */
80
+ export const AmbiguousMapping = "AmbiguousMapping";
81
+ /**
82
+ * The kinds of gap a lacuna can describe. See LacunaTypes in lacuna.cue for what
83
+ * each means.
84
+ */
85
+ export const Defaulted = "Defaulted";
@@ -0,0 +1,43 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0101: a file in the lineage's directory is not a version file
4
+
5
+ A lineage's directory holds its tip, `tip.thema`, at the top, and its frozen
6
+ versions under `history/`, each named `<major>.<minor>.thema`. A `.thema` file
7
+ with any other name or place is not a version file, and there is nothing to
8
+ compile it as.
9
+
10
+ ## Example
11
+
12
+ `ship/history/0.0.thema`:
13
+
14
+ ```cue
15
+ Schema: {
16
+ a: string
17
+ }
18
+ ```
19
+
20
+ `ship/tip.thema`:
21
+
22
+ ```cue
23
+ Schema: {
24
+ a: string
25
+ }
26
+ ```
27
+
28
+ `ship/v1.thema`:
29
+
30
+ ```cue
31
+ Schema: {
32
+ a: string
33
+ b: int
34
+ }
35
+ ```
36
+
37
+ thema reports:
38
+
39
+ ```
40
+ error[E0101]: v1.thema is not a version file
41
+ |
42
+ = help: a lineage's directory holds its tip, tip.thema, and its frozen versions under history/, each named <major>.<minor>.thema
43
+ ```