@marktiderman/genesis-forms 0.4.1 → 0.5.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/dist/server.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { J as Json, e as FormEvent, F as FormDefinition } from './types-BBKBQ8sp.cjs';
2
- import { F as FieldValidator } from './validate-BXXqi0fq.cjs';
1
+ import { F as FieldValidator, H as HostOptions } from './validate-BsZ0YTQS.cjs';
2
+ import { J as Json, e as FormEvent, F as FormDefinition } from './types-BhYUbLJ-.cjs';
3
3
 
4
4
  interface SubmissionInput {
5
5
  /** Answers keyed by field id. Ignored when `events` is given. */
@@ -15,8 +15,33 @@ interface SubmissionOptions {
15
15
  /** `false` checks a draft: formats only, nothing required. Default true. */
16
16
  complete?: boolean | undefined;
17
17
  validators?: Record<string, FieldValidator> | undefined;
18
- /** Most events accepted, counted after `compactEvents`. Default 10 000. */
18
+ /**
19
+ * Most events accepted, counted after `compactEvents`. Default `MAX_EVENTS`
20
+ * (10,000). At most `RAW_EVENTS_PER_EVENT` (10) times as many may be sent.
21
+ */
19
22
  maxEvents?: number | undefined;
23
+ /**
24
+ * Most JSON values in the answers, answer events and hidden inputs
25
+ * together (each number, text, true / false, list item, row and cell
26
+ * counts one; a run of answers to one field, as typing in a table sends,
27
+ * counts its last only). Default `MAX_SUBMISSION_VALUES` (200,000).
28
+ */
29
+ maxValues?: number | undefined;
30
+ /**
31
+ * Most work replaying the events may take: one unit per block each time
32
+ * the path is walked, one per calculated field each time the answers
33
+ * settle, and a formula's size (its numbers, answers and operators) each
34
+ * time it is worked out. Default `MAX_REPLAY_WORK` (1,000,000). Only the
35
+ * replay counts: the submit that follows it does not.
36
+ */
37
+ maxReplayWork?: number | undefined;
38
+ /**
39
+ * The option lists the app supplies for `optionsFrom: { source: "host" }`
40
+ * choice fields, loaded here on the server (never taken from the client):
41
+ * an answer must be one of the field's own options or of these. Pass what
42
+ * the form was shown with, loaded afresh, such as the current staff.
43
+ */
44
+ hostOptions?: HostOptions | undefined;
20
45
  }
21
46
  interface CheckedSubmission {
22
47
  status: "draft" | "completed";
@@ -43,15 +68,24 @@ type SubmissionResult = {
43
68
  };
44
69
  /** Default for `SubmissionOptions.maxEvents`. */
45
70
  declare const MAX_EVENTS = 10000;
71
+ /** Default for `SubmissionOptions.maxValues`. */
72
+ declare const MAX_SUBMISSION_VALUES = 200000;
73
+ /** Default for `SubmissionOptions.maxReplayWork`. */
74
+ declare const MAX_REPLAY_WORK = 1000000;
75
+ /**
76
+ * Most events sent, before compaction, as a multiple of `maxEvents`: a
77
+ * keystroke log compacts to far fewer, but every event sent is looked at.
78
+ */
79
+ declare const RAW_EVENTS_PER_EVENT = 10;
46
80
  /**
47
81
  * Check a submission against the published definition. Never throws on a
48
82
  * malformed submission: it returns `{ ok: false, errors: { "": … } }`.
49
83
  */
50
- declare function validateSubmission(definition: FormDefinition, submission: SubmissionInput, options?: SubmissionOptions): SubmissionResult;
84
+ declare function validateSubmission(published: FormDefinition, submission: SubmissionInput, options?: SubmissionOptions): SubmissionResult;
51
85
  /**
52
86
  * The definition as respondents may see it. R1 forms hold nothing secret;
53
87
  * assessment answer keys (R4) will be stripped here.
54
88
  */
55
89
  declare function publicDefinition(definition: FormDefinition): FormDefinition;
56
90
 
57
- export { type CheckedSubmission, MAX_EVENTS, type SubmissionInput, type SubmissionOptions, type SubmissionResult, publicDefinition, validateSubmission };
91
+ export { type CheckedSubmission, MAX_EVENTS, MAX_REPLAY_WORK, MAX_SUBMISSION_VALUES, RAW_EVENTS_PER_EVENT, type SubmissionInput, type SubmissionOptions, type SubmissionResult, publicDefinition, validateSubmission };
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { J as Json, e as FormEvent, F as FormDefinition } from './types-BBKBQ8sp.js';
2
- import { F as FieldValidator } from './validate-BjNwF1UE.js';
1
+ import { F as FieldValidator, H as HostOptions } from './validate-Bs1lyoOl.js';
2
+ import { J as Json, e as FormEvent, F as FormDefinition } from './types-BhYUbLJ-.js';
3
3
 
4
4
  interface SubmissionInput {
5
5
  /** Answers keyed by field id. Ignored when `events` is given. */
@@ -15,8 +15,33 @@ interface SubmissionOptions {
15
15
  /** `false` checks a draft: formats only, nothing required. Default true. */
16
16
  complete?: boolean | undefined;
17
17
  validators?: Record<string, FieldValidator> | undefined;
18
- /** Most events accepted, counted after `compactEvents`. Default 10 000. */
18
+ /**
19
+ * Most events accepted, counted after `compactEvents`. Default `MAX_EVENTS`
20
+ * (10,000). At most `RAW_EVENTS_PER_EVENT` (10) times as many may be sent.
21
+ */
19
22
  maxEvents?: number | undefined;
23
+ /**
24
+ * Most JSON values in the answers, answer events and hidden inputs
25
+ * together (each number, text, true / false, list item, row and cell
26
+ * counts one; a run of answers to one field, as typing in a table sends,
27
+ * counts its last only). Default `MAX_SUBMISSION_VALUES` (200,000).
28
+ */
29
+ maxValues?: number | undefined;
30
+ /**
31
+ * Most work replaying the events may take: one unit per block each time
32
+ * the path is walked, one per calculated field each time the answers
33
+ * settle, and a formula's size (its numbers, answers and operators) each
34
+ * time it is worked out. Default `MAX_REPLAY_WORK` (1,000,000). Only the
35
+ * replay counts: the submit that follows it does not.
36
+ */
37
+ maxReplayWork?: number | undefined;
38
+ /**
39
+ * The option lists the app supplies for `optionsFrom: { source: "host" }`
40
+ * choice fields, loaded here on the server (never taken from the client):
41
+ * an answer must be one of the field's own options or of these. Pass what
42
+ * the form was shown with, loaded afresh, such as the current staff.
43
+ */
44
+ hostOptions?: HostOptions | undefined;
20
45
  }
21
46
  interface CheckedSubmission {
22
47
  status: "draft" | "completed";
@@ -43,15 +68,24 @@ type SubmissionResult = {
43
68
  };
44
69
  /** Default for `SubmissionOptions.maxEvents`. */
45
70
  declare const MAX_EVENTS = 10000;
71
+ /** Default for `SubmissionOptions.maxValues`. */
72
+ declare const MAX_SUBMISSION_VALUES = 200000;
73
+ /** Default for `SubmissionOptions.maxReplayWork`. */
74
+ declare const MAX_REPLAY_WORK = 1000000;
75
+ /**
76
+ * Most events sent, before compaction, as a multiple of `maxEvents`: a
77
+ * keystroke log compacts to far fewer, but every event sent is looked at.
78
+ */
79
+ declare const RAW_EVENTS_PER_EVENT = 10;
46
80
  /**
47
81
  * Check a submission against the published definition. Never throws on a
48
82
  * malformed submission: it returns `{ ok: false, errors: { "": … } }`.
49
83
  */
50
- declare function validateSubmission(definition: FormDefinition, submission: SubmissionInput, options?: SubmissionOptions): SubmissionResult;
84
+ declare function validateSubmission(published: FormDefinition, submission: SubmissionInput, options?: SubmissionOptions): SubmissionResult;
51
85
  /**
52
86
  * The definition as respondents may see it. R1 forms hold nothing secret;
53
87
  * assessment answer keys (R4) will be stripped here.
54
88
  */
55
89
  declare function publicDefinition(definition: FormDefinition): FormDefinition;
56
90
 
57
- export { type CheckedSubmission, MAX_EVENTS, type SubmissionInput, type SubmissionOptions, type SubmissionResult, publicDefinition, validateSubmission };
91
+ export { type CheckedSubmission, MAX_EVENTS, MAX_REPLAY_WORK, MAX_SUBMISSION_VALUES, RAW_EVENTS_PER_EVENT, type SubmissionInput, type SubmissionOptions, type SubmissionResult, publicDefinition, validateSubmission };