@marktiderman/genesis-forms 0.0.0-stage → 0.1.1

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 (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +146 -2
  3. package/conformance/after-class-back-after-a-jump.scenario.json +217 -0
  4. package/conformance/after-class-contact-yes-completed.scenario.json +230 -0
  5. package/conformance/after-class-contact-yes-requires-name-and-email.scenario.json +218 -0
  6. package/conformance/after-class-happy-path.scenario.json +237 -0
  7. package/conformance/after-class-invalid-email-rejected.scenario.json +227 -0
  8. package/conformance/after-class-low-rating-skips-went-well.scenario.json +223 -0
  9. package/conformance/after-class-server-drops-unknown-and-hidden-answers.scenario.json +236 -0
  10. package/conformance/after-class-server-ignores-a-client-sent-coach.scenario.json +219 -0
  11. package/conformance/contact-details-anonymous-form-skips-identifying-fields.scenario.json +125 -0
  12. package/conformance/contact-details-named-form-asks-for-identifying-fields.scenario.json +129 -0
  13. package/conformance/monthly-pulse-default-ending.scenario.json +148 -0
  14. package/conformance/monthly-pulse-promoter-ending-via-jump.scenario.json +128 -0
  15. package/dist/engine-Cp5t2_Am.d.ts +75 -0
  16. package/dist/engine-LsPRTzt3.d.cts +75 -0
  17. package/dist/index.cjs +1205 -0
  18. package/dist/index.cjs.map +1 -0
  19. package/dist/index.d.cts +374 -0
  20. package/dist/index.d.ts +374 -0
  21. package/dist/index.js +1174 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/server.cjs +988 -0
  24. package/dist/server.cjs.map +1 -0
  25. package/dist/server.d.cts +52 -0
  26. package/dist/server.d.ts +52 -0
  27. package/dist/server.js +984 -0
  28. package/dist/server.js.map +1 -0
  29. package/dist/testing.cjs +1299 -0
  30. package/dist/testing.cjs.map +1 -0
  31. package/dist/testing.d.cts +129 -0
  32. package/dist/testing.d.ts +129 -0
  33. package/dist/testing.js +1293 -0
  34. package/dist/testing.js.map +1 -0
  35. package/dist/validate-j8Z188mF.d.cts +175 -0
  36. package/dist/validate-j8Z188mF.d.ts +175 -0
  37. package/package.json +79 -3
@@ -0,0 +1,223 @@
1
+ {
2
+ "scenarioVersion": 1,
3
+ "name": "after-class: low rating skips went_well",
4
+ "description": "A rating under 4 jumps from overall to improve; went_well is off the path. Keystrokes in improve are compacted.",
5
+ "tags": [
6
+ "after-class",
7
+ "jump"
8
+ ],
9
+ "definition": {
10
+ "schemaVersion": 1,
11
+ "id": "after-class",
12
+ "title": "How was class?",
13
+ "blocks": [
14
+ {
15
+ "kind": "field",
16
+ "id": "overall",
17
+ "key": "overall",
18
+ "type": "rating",
19
+ "label": "How was today's class?",
20
+ "required": true,
21
+ "props": {
22
+ "max": 5
23
+ }
24
+ },
25
+ {
26
+ "kind": "field",
27
+ "id": "went_well",
28
+ "key": "went_well",
29
+ "type": "multi-choice",
30
+ "label": "What went well?",
31
+ "props": {
32
+ "options": [
33
+ {
34
+ "value": "coaching",
35
+ "label": "Coaching"
36
+ },
37
+ {
38
+ "value": "workout",
39
+ "label": "The workout"
40
+ },
41
+ {
42
+ "value": "community",
43
+ "label": "Community"
44
+ },
45
+ {
46
+ "value": "scaling",
47
+ "label": "Scaling options"
48
+ },
49
+ {
50
+ "value": "equipment",
51
+ "label": "Equipment"
52
+ },
53
+ {
54
+ "value": "cleanliness",
55
+ "label": "Cleanliness"
56
+ }
57
+ ]
58
+ }
59
+ },
60
+ {
61
+ "kind": "field",
62
+ "id": "improve",
63
+ "key": "improve",
64
+ "type": "long-text",
65
+ "label": "Anything we could do better?"
66
+ },
67
+ {
68
+ "kind": "field",
69
+ "id": "contact_me",
70
+ "key": "contact_me",
71
+ "type": "yes-no",
72
+ "label": "Want {{hidden:coach|a coach}} to follow up with you?"
73
+ },
74
+ {
75
+ "kind": "field",
76
+ "id": "name",
77
+ "key": "name",
78
+ "type": "short-text",
79
+ "label": "Your name",
80
+ "required": true
81
+ },
82
+ {
83
+ "kind": "field",
84
+ "id": "email",
85
+ "key": "email",
86
+ "type": "email",
87
+ "label": "Best email to reach you",
88
+ "required": true
89
+ }
90
+ ],
91
+ "layout": {
92
+ "mode": "focus"
93
+ },
94
+ "hidden": [
95
+ {
96
+ "name": "class",
97
+ "type": "string",
98
+ "source": "server"
99
+ },
100
+ {
101
+ "name": "coach",
102
+ "type": "string",
103
+ "source": "server"
104
+ }
105
+ ],
106
+ "logic": [
107
+ {
108
+ "id": "r1",
109
+ "when": {
110
+ "op": "neq",
111
+ "left": {
112
+ "field": "contact_me"
113
+ },
114
+ "right": {
115
+ "value": true
116
+ }
117
+ },
118
+ "effect": "hide",
119
+ "target": "name"
120
+ },
121
+ {
122
+ "id": "r2",
123
+ "when": {
124
+ "op": "neq",
125
+ "left": {
126
+ "field": "contact_me"
127
+ },
128
+ "right": {
129
+ "value": true
130
+ }
131
+ },
132
+ "effect": "hide",
133
+ "target": "email"
134
+ },
135
+ {
136
+ "id": "r3",
137
+ "when": {
138
+ "op": "lt",
139
+ "left": {
140
+ "field": "overall"
141
+ },
142
+ "right": {
143
+ "value": 4
144
+ }
145
+ },
146
+ "effect": "jump",
147
+ "from": "overall",
148
+ "to": "improve"
149
+ }
150
+ ],
151
+ "endings": [
152
+ {
153
+ "id": "default",
154
+ "title": "Thanks! See you at the next class."
155
+ }
156
+ ],
157
+ "settings": {
158
+ "anonymous": true
159
+ }
160
+ },
161
+ "context": {
162
+ "class": "6:00 AM CrossFit",
163
+ "coach": "Sam"
164
+ },
165
+ "events": [
166
+ {
167
+ "type": "answer",
168
+ "field": "overall",
169
+ "value": 2
170
+ },
171
+ {
172
+ "type": "next"
173
+ },
174
+ {
175
+ "type": "answer",
176
+ "field": "improve",
177
+ "value": "Music too loud"
178
+ },
179
+ {
180
+ "type": "next"
181
+ },
182
+ {
183
+ "type": "answer",
184
+ "field": "contact_me",
185
+ "value": false
186
+ },
187
+ {
188
+ "type": "submit"
189
+ }
190
+ ],
191
+ "expect": {
192
+ "path": [
193
+ "overall",
194
+ "improve",
195
+ "contact_me"
196
+ ],
197
+ "visible": [
198
+ "overall",
199
+ "improve",
200
+ "contact_me"
201
+ ],
202
+ "current": "contact_me",
203
+ "status": "completed",
204
+ "ending": "default",
205
+ "answers": {
206
+ "overall": 2,
207
+ "improve": "Music too loud",
208
+ "contact_me": false
209
+ },
210
+ "server": {
211
+ "ok": true,
212
+ "answers": {
213
+ "overall": 2,
214
+ "improve": "Music too loud",
215
+ "contact_me": false
216
+ },
217
+ "context": {
218
+ "class": "6:00 AM CrossFit",
219
+ "coach": "Sam"
220
+ }
221
+ }
222
+ }
223
+ }
@@ -0,0 +1,236 @@
1
+ {
2
+ "scenarioVersion": 1,
3
+ "name": "after-class: server drops unknown and hidden answers",
4
+ "description": "The server replays the log: unknown fields are ignored, and answers to fields jumped over or hidden by logic are not stored.",
5
+ "tags": [
6
+ "after-class",
7
+ "server",
8
+ "security"
9
+ ],
10
+ "definition": {
11
+ "schemaVersion": 1,
12
+ "id": "after-class",
13
+ "title": "How was class?",
14
+ "blocks": [
15
+ {
16
+ "kind": "field",
17
+ "id": "overall",
18
+ "key": "overall",
19
+ "type": "rating",
20
+ "label": "How was today's class?",
21
+ "required": true,
22
+ "props": {
23
+ "max": 5
24
+ }
25
+ },
26
+ {
27
+ "kind": "field",
28
+ "id": "went_well",
29
+ "key": "went_well",
30
+ "type": "multi-choice",
31
+ "label": "What went well?",
32
+ "props": {
33
+ "options": [
34
+ {
35
+ "value": "coaching",
36
+ "label": "Coaching"
37
+ },
38
+ {
39
+ "value": "workout",
40
+ "label": "The workout"
41
+ },
42
+ {
43
+ "value": "community",
44
+ "label": "Community"
45
+ },
46
+ {
47
+ "value": "scaling",
48
+ "label": "Scaling options"
49
+ },
50
+ {
51
+ "value": "equipment",
52
+ "label": "Equipment"
53
+ },
54
+ {
55
+ "value": "cleanliness",
56
+ "label": "Cleanliness"
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "kind": "field",
63
+ "id": "improve",
64
+ "key": "improve",
65
+ "type": "long-text",
66
+ "label": "Anything we could do better?"
67
+ },
68
+ {
69
+ "kind": "field",
70
+ "id": "contact_me",
71
+ "key": "contact_me",
72
+ "type": "yes-no",
73
+ "label": "Want {{hidden:coach|a coach}} to follow up with you?"
74
+ },
75
+ {
76
+ "kind": "field",
77
+ "id": "name",
78
+ "key": "name",
79
+ "type": "short-text",
80
+ "label": "Your name",
81
+ "required": true
82
+ },
83
+ {
84
+ "kind": "field",
85
+ "id": "email",
86
+ "key": "email",
87
+ "type": "email",
88
+ "label": "Best email to reach you",
89
+ "required": true
90
+ }
91
+ ],
92
+ "layout": {
93
+ "mode": "focus"
94
+ },
95
+ "hidden": [
96
+ {
97
+ "name": "class",
98
+ "type": "string",
99
+ "source": "server"
100
+ },
101
+ {
102
+ "name": "coach",
103
+ "type": "string",
104
+ "source": "server"
105
+ }
106
+ ],
107
+ "logic": [
108
+ {
109
+ "id": "r1",
110
+ "when": {
111
+ "op": "neq",
112
+ "left": {
113
+ "field": "contact_me"
114
+ },
115
+ "right": {
116
+ "value": true
117
+ }
118
+ },
119
+ "effect": "hide",
120
+ "target": "name"
121
+ },
122
+ {
123
+ "id": "r2",
124
+ "when": {
125
+ "op": "neq",
126
+ "left": {
127
+ "field": "contact_me"
128
+ },
129
+ "right": {
130
+ "value": true
131
+ }
132
+ },
133
+ "effect": "hide",
134
+ "target": "email"
135
+ },
136
+ {
137
+ "id": "r3",
138
+ "when": {
139
+ "op": "lt",
140
+ "left": {
141
+ "field": "overall"
142
+ },
143
+ "right": {
144
+ "value": 4
145
+ }
146
+ },
147
+ "effect": "jump",
148
+ "from": "overall",
149
+ "to": "improve"
150
+ }
151
+ ],
152
+ "endings": [
153
+ {
154
+ "id": "default",
155
+ "title": "Thanks! See you at the next class."
156
+ }
157
+ ],
158
+ "settings": {
159
+ "anonymous": true
160
+ }
161
+ },
162
+ "context": {
163
+ "class": "6:00 AM CrossFit",
164
+ "coach": "Sam"
165
+ },
166
+ "events": [
167
+ {
168
+ "type": "answer",
169
+ "field": "overall",
170
+ "value": 5
171
+ },
172
+ {
173
+ "type": "answer",
174
+ "field": "went_well",
175
+ "value": [
176
+ "workout"
177
+ ]
178
+ },
179
+ {
180
+ "type": "answer",
181
+ "field": "bogus",
182
+ "value": "drop me"
183
+ },
184
+ {
185
+ "type": "answer",
186
+ "field": "name",
187
+ "value": "Not asked"
188
+ },
189
+ {
190
+ "type": "answer",
191
+ "field": "overall",
192
+ "value": 3
193
+ },
194
+ {
195
+ "type": "answer",
196
+ "field": "contact_me",
197
+ "value": false
198
+ },
199
+ {
200
+ "type": "submit"
201
+ }
202
+ ],
203
+ "expect": {
204
+ "path": [
205
+ "overall",
206
+ "improve",
207
+ "contact_me"
208
+ ],
209
+ "visible": [
210
+ "overall",
211
+ "improve",
212
+ "contact_me"
213
+ ],
214
+ "current": "overall",
215
+ "status": "completed",
216
+ "ending": "default",
217
+ "answers": {
218
+ "overall": 3,
219
+ "contact_me": false
220
+ },
221
+ "server": {
222
+ "ok": true,
223
+ "answers": {
224
+ "overall": 3,
225
+ "contact_me": false
226
+ },
227
+ "context": {
228
+ "class": "6:00 AM CrossFit",
229
+ "coach": "Sam"
230
+ },
231
+ "ignored": [
232
+ "bogus"
233
+ ]
234
+ }
235
+ }
236
+ }
@@ -0,0 +1,219 @@
1
+ {
2
+ "scenarioVersion": 1,
3
+ "name": "after-class: server ignores a client-sent coach",
4
+ "description": "coach is a server input. A value sent by the client is dropped and reported in ignored; the server's own value is stored.",
5
+ "tags": [
6
+ "after-class",
7
+ "server",
8
+ "security"
9
+ ],
10
+ "definition": {
11
+ "schemaVersion": 1,
12
+ "id": "after-class",
13
+ "title": "How was class?",
14
+ "blocks": [
15
+ {
16
+ "kind": "field",
17
+ "id": "overall",
18
+ "key": "overall",
19
+ "type": "rating",
20
+ "label": "How was today's class?",
21
+ "required": true,
22
+ "props": {
23
+ "max": 5
24
+ }
25
+ },
26
+ {
27
+ "kind": "field",
28
+ "id": "went_well",
29
+ "key": "went_well",
30
+ "type": "multi-choice",
31
+ "label": "What went well?",
32
+ "props": {
33
+ "options": [
34
+ {
35
+ "value": "coaching",
36
+ "label": "Coaching"
37
+ },
38
+ {
39
+ "value": "workout",
40
+ "label": "The workout"
41
+ },
42
+ {
43
+ "value": "community",
44
+ "label": "Community"
45
+ },
46
+ {
47
+ "value": "scaling",
48
+ "label": "Scaling options"
49
+ },
50
+ {
51
+ "value": "equipment",
52
+ "label": "Equipment"
53
+ },
54
+ {
55
+ "value": "cleanliness",
56
+ "label": "Cleanliness"
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "kind": "field",
63
+ "id": "improve",
64
+ "key": "improve",
65
+ "type": "long-text",
66
+ "label": "Anything we could do better?"
67
+ },
68
+ {
69
+ "kind": "field",
70
+ "id": "contact_me",
71
+ "key": "contact_me",
72
+ "type": "yes-no",
73
+ "label": "Want {{hidden:coach|a coach}} to follow up with you?"
74
+ },
75
+ {
76
+ "kind": "field",
77
+ "id": "name",
78
+ "key": "name",
79
+ "type": "short-text",
80
+ "label": "Your name",
81
+ "required": true
82
+ },
83
+ {
84
+ "kind": "field",
85
+ "id": "email",
86
+ "key": "email",
87
+ "type": "email",
88
+ "label": "Best email to reach you",
89
+ "required": true
90
+ }
91
+ ],
92
+ "layout": {
93
+ "mode": "focus"
94
+ },
95
+ "hidden": [
96
+ {
97
+ "name": "class",
98
+ "type": "string",
99
+ "source": "server"
100
+ },
101
+ {
102
+ "name": "coach",
103
+ "type": "string",
104
+ "source": "server"
105
+ }
106
+ ],
107
+ "logic": [
108
+ {
109
+ "id": "r1",
110
+ "when": {
111
+ "op": "neq",
112
+ "left": {
113
+ "field": "contact_me"
114
+ },
115
+ "right": {
116
+ "value": true
117
+ }
118
+ },
119
+ "effect": "hide",
120
+ "target": "name"
121
+ },
122
+ {
123
+ "id": "r2",
124
+ "when": {
125
+ "op": "neq",
126
+ "left": {
127
+ "field": "contact_me"
128
+ },
129
+ "right": {
130
+ "value": true
131
+ }
132
+ },
133
+ "effect": "hide",
134
+ "target": "email"
135
+ },
136
+ {
137
+ "id": "r3",
138
+ "when": {
139
+ "op": "lt",
140
+ "left": {
141
+ "field": "overall"
142
+ },
143
+ "right": {
144
+ "value": 4
145
+ }
146
+ },
147
+ "effect": "jump",
148
+ "from": "overall",
149
+ "to": "improve"
150
+ }
151
+ ],
152
+ "endings": [
153
+ {
154
+ "id": "default",
155
+ "title": "Thanks! See you at the next class."
156
+ }
157
+ ],
158
+ "settings": {
159
+ "anonymous": true
160
+ }
161
+ },
162
+ "hidden": {
163
+ "coach": "Mallory"
164
+ },
165
+ "context": {
166
+ "class": "6:00 AM CrossFit",
167
+ "coach": "Sam"
168
+ },
169
+ "events": [
170
+ {
171
+ "type": "answer",
172
+ "field": "overall",
173
+ "value": 5
174
+ },
175
+ {
176
+ "type": "answer",
177
+ "field": "contact_me",
178
+ "value": false
179
+ },
180
+ {
181
+ "type": "submit"
182
+ }
183
+ ],
184
+ "expect": {
185
+ "path": [
186
+ "overall",
187
+ "went_well",
188
+ "improve",
189
+ "contact_me"
190
+ ],
191
+ "visible": [
192
+ "overall",
193
+ "went_well",
194
+ "improve",
195
+ "contact_me"
196
+ ],
197
+ "current": "overall",
198
+ "status": "completed",
199
+ "ending": "default",
200
+ "answers": {
201
+ "overall": 5,
202
+ "contact_me": false
203
+ },
204
+ "server": {
205
+ "ok": true,
206
+ "answers": {
207
+ "overall": 5,
208
+ "contact_me": false
209
+ },
210
+ "context": {
211
+ "class": "6:00 AM CrossFit",
212
+ "coach": "Sam"
213
+ },
214
+ "ignored": [
215
+ "hidden.coach"
216
+ ]
217
+ }
218
+ }
219
+ }