@marktiderman/genesis-forms 0.4.1 → 0.4.2
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 +22 -5
- package/dist/destinations.cjs.map +1 -1
- package/dist/destinations.js.map +1 -1
- package/dist/index.cjs +125 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +125 -44
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +201 -51
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +29 -2
- package/dist/server.d.ts +29 -2
- package/dist/server.js +199 -52
- package/dist/server.js.map +1 -1
- package/dist/testing.cjs +200 -50
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +200 -50
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -170,12 +170,29 @@ Limits, so a large submission can't make the server slow:
|
|
|
170
170
|
- A calculated field that reads a list or table of more than `MAX_FORMULA_ITEMS` (10,000) items
|
|
171
171
|
has no value: it is blank, never `0` or a partial total. The same goes for one that reads an
|
|
172
172
|
answer past `MAX_SETTLE_ITEMS` (50,000) items read by all of a form's formulas together (each
|
|
173
|
-
|
|
173
|
+
list or table counted once, however many of its columns are read, in form order; an answer over
|
|
174
|
+
10,000 items counts for none).
|
|
174
175
|
Nothing else reports this, so give a table a `maxRows` well under these if its total matters.
|
|
175
176
|
- A formula is at most `MAX_FORMULA_LENGTH` characters and 64 levels of parentheses, calls, signs
|
|
176
177
|
and `? :` deep, and all of a form's formulas together at most `MAX_FORM_FORMULA_LENGTH` (20,000).
|
|
177
|
-
- Lists are read once per answer, so treat answers as immutable: pass `setValue` a new
|
|
178
|
-
|
|
178
|
+
- Lists are read once per answer, so treat an engine's answers as immutable: pass `setValue` a new
|
|
179
|
+
array (the engine and the built-in renderers never change one in place). `setValue` with the
|
|
180
|
+
array it already holds works it out again. Each engine, and so each `validateSubmission` call,
|
|
181
|
+
keeps its own lists, so the same object passed again after a change is read afresh.
|
|
182
|
+
- `validateSubmission` refuses a submission that would be too much work, with an error under `""`,
|
|
183
|
+
and never cuts one short. It doesn't rely on the host's request size limit. Each limit is an
|
|
184
|
+
option for a host that needs more:
|
|
185
|
+
|
|
186
|
+
| Limit | Default | Option | Counts |
|
|
187
|
+
| --- | --- | --- | --- |
|
|
188
|
+
| `MAX_EVENTS` | 10,000 | `maxEvents` | Events, after `compactEvents`; at most `RAW_EVENTS_PER_EVENT` (10) times as many may be sent |
|
|
189
|
+
| `MAX_SUBMISSION_VALUES` | 200,000 | `maxValues` | JSON values in the answers, answer events and hidden inputs: each number, text, true / false, list item, row and cell. A run of answers to one field (a table sends itself on every keystroke) counts its last only |
|
|
190
|
+
| `MAX_REPLAY_WORK` | 1,000,000 | `maxReplayWork` | Replaying the events: one unit per block each time the path is walked, one per calculated field each time the answers settle, and a formula's size (its numbers, answers and operators) each time it is worked out. The submit after the replay isn't counted |
|
|
191
|
+
|
|
192
|
+
A respondent filling in a long form with formulas uses about 400,000 units of replay work at
|
|
193
|
+
most; the limit stops a log built to make every step work out every formula. After a refusal,
|
|
194
|
+
sending the same body again gets the same answer, so show the `""` message rather than offer
|
|
195
|
+
"Try again".
|
|
179
196
|
|
|
180
197
|
The engine works the values out from the answers on the path (an answer hidden by logic reads as
|
|
181
198
|
blank), again whenever an answer it reads changes, and stores them with the answers, so `engine.answers()` and a
|
|
@@ -213,8 +230,8 @@ await store(result.submission); // answers, hidden, context, ending
|
|
|
213
230
|
```
|
|
214
231
|
|
|
215
232
|
Errors are keyed by field id. The `""` key is for the whole submission: `"Malformed submission."`
|
|
216
|
-
(a body of the wrong shape), a definition that fails `parseForm`, or
|
|
217
|
-
|
|
233
|
+
(a body of the wrong shape), a definition that fails `parseForm`, or a submission past one of the
|
|
234
|
+
limits above (`maxEvents`, `maxValues`, `maxReplayWork`). Events of an unknown type are dropped, so a newer
|
|
218
235
|
client's log still replays. With `settings.clearHiddenValues: false`, a hidden field's value is kept
|
|
219
236
|
only if its format is valid.
|
|
220
237
|
|