@iyulab/lowline-form 0.10.0 → 0.12.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,7 +1,8 @@
1
1
  # `<lowline-form>`
2
2
 
3
3
  A formdown form whose decided fields are suggested from the records people confirmed, talking to a Lowline host's
4
- routes (`MapLowline` in .NET).
4
+ routes — the contract at the end of this page, which a host implements over the engine (the .NET reference host is
5
+ [`samples/aspnet`](../../samples/aspnet)).
5
6
 
6
7
  ```html
7
8
  <lowline-form src="/lowline" form="intake" record="r-17"></lowline-form>
@@ -20,6 +21,8 @@ routes (`MapLowline` in .NET).
20
21
  | `content` | The form's formdown text. |
21
22
  | `data` | The record's values when it was opened. |
22
23
  | `rate` | How often a field's answer is held back to check it, from 0 to 1 (one in twenty by default). |
24
+ | `prefill` | Whether a suggestion the engine allows to go in unasked is put in the field before the person takes it. Off by default — a value in a field reads as the person's own. |
25
+ | `promise-rate` | How often a suggestion's promise — right *n* times in 10 like it, rounded down — is shown beside it, from 0 to 1. Off (0) by default; the draw goes into the record, so showing it can be measured before it is turned on for everyone. |
23
26
  | `strings` | The words the form shows, in the host's language. |
24
27
  | `settled-by` | Who is writing, as an opaque id the host gives — one person, one id, never a name. Sent with the save when set. |
25
28
  | `batch` | The batch the record is written in, when several come at once from one source. Sent with the save when set. |
@@ -43,3 +46,18 @@ npm ci
43
46
  npm test
44
47
  npm run bundle # one file with Lit and formdown inside, in dist/bundle
45
48
  ```
49
+
50
+ ## The routes a host serves
51
+
52
+ Under the prefix the host mounted them at (`src`):
53
+
54
+ | Route | Takes | Answers |
55
+ |---|---|---|
56
+ | `POST {form}/propose` | `{ "id", "values" }` — the record so far | per open decided field: the suggestion, what it rests on, its `promise`, or why there is none |
57
+ | `POST {form}/settle` | `{ "id", "saved", "draft" }` — no `saved` with `Saved` | `{ "id", "settledAt" }`; 400 for a value the form cannot hold, and nothing is learned |
58
+ | `GET {form}/report` | — | per decided field: the thresholds chosen, how many records they were chosen on (`chosenOn`), and what the replay of the records saw at them |
59
+ | `POST {form}/fill` | `{ "values", "text", "attachments" }` — `attachments`, optional: what the person showed, each `{ "mediaType", "data" (base64), "name" }`; `text` may be empty when something is shown | the model's values as suggestions; 400 for data that is not base64; 404 saying so without a model |
60
+ | `POST {form}/judge` | `{ "id", "values" }` | the model's judgements for the fields the records could not answer; 404 saying so without a model |
61
+
62
+ A form not defined is 404. Each request's memory space and allowed choices come from the host, never from the request
63
+ body. The shapes are the engine's own wire shapes: in .NET, `LowlineJson` serializes them.