@defra/forms-model 3.0.431 → 3.0.433

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 (70) hide show
  1. package/dist/module/form/form-definition/index.js +2 -1
  2. package/dist/module/form/form-definition/index.js.map +1 -1
  3. package/dist/module/form/form-definition/types.js.map +1 -1
  4. package/dist/module/form/form-editor/index.js +107 -0
  5. package/dist/module/form/form-editor/index.js.map +1 -1
  6. package/dist/module/form/form-editor/types.js.map +1 -1
  7. package/dist/module/form/form-manager/index.js +1 -1
  8. package/dist/module/form/form-manager/index.js.map +1 -1
  9. package/dist/types/form/form-definition/index.d.ts.map +1 -1
  10. package/dist/types/form/form-definition/types.d.ts +1 -0
  11. package/dist/types/form/form-definition/types.d.ts.map +1 -1
  12. package/dist/types/form/form-editor/index.d.ts +21 -1
  13. package/dist/types/form/form-editor/index.d.ts.map +1 -1
  14. package/dist/types/form/form-editor/types.d.ts +8 -2
  15. package/dist/types/form/form-editor/types.d.ts.map +1 -1
  16. package/dist/types/form/form-manager/index.d.ts +1 -1
  17. package/dist/types/form/form-manager/index.d.ts.map +1 -1
  18. package/package.json +1 -1
  19. package/schemas/component-schema-v2.json +162 -0
  20. package/schemas/component-schema.json +162 -0
  21. package/schemas/date-sub-schema.json +11 -0
  22. package/schemas/form-definition-schema.json +1886 -0
  23. package/schemas/form-definition-v2-payload-schema.json +1469 -0
  24. package/schemas/form-editor-input-check-answers-setting-schema.json +18 -0
  25. package/schemas/form-editor-input-page-schema.json +41 -0
  26. package/schemas/form-editor-input-page-settings-schema.json +28 -0
  27. package/schemas/form-editor-input-question-schema.json +38 -0
  28. package/schemas/form-metadata-author-schema.json +24 -0
  29. package/schemas/form-metadata-contact-schema.json +61 -0
  30. package/schemas/form-metadata-email-schema.json +25 -0
  31. package/schemas/form-metadata-input-schema.json +127 -0
  32. package/schemas/form-metadata-online-schema.json +25 -0
  33. package/schemas/form-metadata-schema.json +340 -0
  34. package/schemas/form-metadata-state-schema.json +72 -0
  35. package/schemas/form-submit-payload-schema.json +124 -0
  36. package/schemas/form-submit-record-schema.json +30 -0
  37. package/schemas/form-submit-recordset-schema.json +62 -0
  38. package/schemas/list-schema-v2.json +496 -0
  39. package/schemas/list-schema.json +496 -0
  40. package/schemas/max-future-schema.json +8 -0
  41. package/schemas/max-length-schema.json +8 -0
  42. package/schemas/max-past-schema.json +8 -0
  43. package/schemas/max-schema.json +7 -0
  44. package/schemas/min-length-schema.json +8 -0
  45. package/schemas/min-schema.json +7 -0
  46. package/schemas/page-schema-payload-v2.json +400 -0
  47. package/schemas/page-schema-v2.json +400 -0
  48. package/schemas/page-schema.json +400 -0
  49. package/schemas/page-type-schema.json +11 -0
  50. package/schemas/pagination-options-schema.json +27 -0
  51. package/schemas/patch-page-schema.json +26 -0
  52. package/schemas/query-options-schema.json +94 -0
  53. package/schemas/question-schema.json +7 -0
  54. package/schemas/question-type-full-schema.json +22 -0
  55. package/schemas/question-type-schema.json +20 -0
  56. package/schemas/search-options-schema.json +59 -0
  57. package/schemas/sorting-options-schema.json +28 -0
  58. package/schemas/written-answer-sub-schema.json +12 -0
  59. package/src/form/form-definition/index.ts +5 -1
  60. package/src/form/form-definition/types.ts +1 -0
  61. package/src/form/form-editor/index.ts +147 -1
  62. package/src/form/form-editor/types.ts +19 -2
  63. package/src/form/form-manager/index.ts +1 -1
  64. package/scripts/generate-schemas.js +0 -238
  65. package/scripts/schema-modules/constants.js +0 -39
  66. package/scripts/schema-modules/schema-processors.js +0 -109
  67. package/scripts/schema-modules/schema-simplifiers.js +0 -351
  68. package/scripts/schema-modules/title-processors.js +0 -327
  69. package/scripts/schema-modules/types.js +0 -21
  70. package/scripts/schema-modules/utils.js +0 -41
@@ -0,0 +1,340 @@
1
+ {
2
+ "type": "object",
3
+ "description": "Complete metadata for a form, including version information and authoring details",
4
+ "properties": {
5
+ "title": {
6
+ "type": "string",
7
+ "description": "Title of the form, displayed to users",
8
+ "maxLength": 250,
9
+ "title": "Title"
10
+ },
11
+ "organisation": {
12
+ "type": "string",
13
+ "description": "Defra organisation responsible for the form",
14
+ "enum": [
15
+ "Animal and Plant Health Agency – APHA",
16
+ "Centre for Environment, Fisheries and Aquaculture Science – Cefas",
17
+ "Defra",
18
+ "Environment Agency",
19
+ "Forestry Commission",
20
+ "Marine Management Organisation – MMO",
21
+ "Natural England",
22
+ "Rural Payments Agency – RPA",
23
+ "Veterinary Medicines Directorate – VMD"
24
+ ],
25
+ "title": "Organisation"
26
+ },
27
+ "teamName": {
28
+ "type": "string",
29
+ "description": "Name of the team responsible for the form",
30
+ "maxLength": 100,
31
+ "title": "Team Name"
32
+ },
33
+ "teamEmail": {
34
+ "type": "string",
35
+ "description": "Contact email for the team responsible for the form",
36
+ "format": "email",
37
+ "title": "Team Email"
38
+ },
39
+ "contact": {
40
+ "type": "object",
41
+ "description": "Complete contact information for form-related inquiries",
42
+ "properties": {
43
+ "phone": {
44
+ "type": "string",
45
+ "description": "Phone number for form-related inquiries",
46
+ "title": "Phone"
47
+ },
48
+ "email": {
49
+ "type": "object",
50
+ "description": "Email contact details including response expectations",
51
+ "properties": {
52
+ "address": {
53
+ "type": "string",
54
+ "description": "Email address for form-related inquiries",
55
+ "format": "email",
56
+ "title": "Address"
57
+ },
58
+ "responseTime": {
59
+ "type": "string",
60
+ "description": "Expected response time for email inquiries",
61
+ "title": "Response Time"
62
+ }
63
+ },
64
+ "required": [
65
+ "address",
66
+ "responseTime"
67
+ ],
68
+ "additionalProperties": false,
69
+ "title": "Email"
70
+ },
71
+ "online": {
72
+ "type": "object",
73
+ "description": "Online contact details with URL and descriptive text",
74
+ "properties": {
75
+ "url": {
76
+ "type": "string",
77
+ "description": "URL for online contact method",
78
+ "format": "uri",
79
+ "title": "Url"
80
+ },
81
+ "text": {
82
+ "type": "string",
83
+ "description": "Descriptive text for the online contact link",
84
+ "title": "Text"
85
+ }
86
+ },
87
+ "required": [
88
+ "url",
89
+ "text"
90
+ ],
91
+ "additionalProperties": false,
92
+ "title": "Online"
93
+ }
94
+ },
95
+ "additionalProperties": false,
96
+ "title": "Contact"
97
+ },
98
+ "submissionGuidance": {
99
+ "type": "string",
100
+ "description": "Guidance text shown to users when submitting the form",
101
+ "title": "Submission Guidance"
102
+ },
103
+ "privacyNoticeUrl": {
104
+ "type": "string",
105
+ "description": "URL to the privacy notice for this form",
106
+ "format": "uri",
107
+ "title": "Privacy Notice Url"
108
+ },
109
+ "notificationEmail": {
110
+ "type": "string",
111
+ "description": "Email address to receive form submission notifications, must be a .gov.uk or .org.uk address",
112
+ "format": "email",
113
+ "pattern": "\\.gov\\.uk$|\\.org\\.uk$",
114
+ "title": "Notification Email"
115
+ },
116
+ "id": {
117
+ "type": "string",
118
+ "description": "Unique identifier for the form, 24-character hexadecimal string",
119
+ "title": "Id"
120
+ },
121
+ "slug": {
122
+ "type": "string",
123
+ "description": "URL-friendly identifier used in form paths",
124
+ "pattern": "^[a-z0-9-]+$",
125
+ "title": "Slug"
126
+ },
127
+ "draft": {
128
+ "type": "object",
129
+ "description": "Metadata for the draft version",
130
+ "properties": {
131
+ "createdAt": {
132
+ "type": "string",
133
+ "description": "When this version was first created",
134
+ "format": "date-time",
135
+ "title": "Created At"
136
+ },
137
+ "createdBy": {
138
+ "type": "object",
139
+ "description": "Who created this version",
140
+ "properties": {
141
+ "id": {
142
+ "type": "string",
143
+ "description": "Unique identifier for the author",
144
+ "title": "Id"
145
+ },
146
+ "displayName": {
147
+ "type": "string",
148
+ "description": "Human-readable name of the author",
149
+ "title": "Display Name"
150
+ }
151
+ },
152
+ "required": [
153
+ "id",
154
+ "displayName"
155
+ ],
156
+ "additionalProperties": false,
157
+ "title": "Created By"
158
+ },
159
+ "updatedAt": {
160
+ "type": "string",
161
+ "description": "When this version was last updated",
162
+ "format": "date-time",
163
+ "title": "Updated At"
164
+ },
165
+ "updatedBy": {
166
+ "type": "object",
167
+ "description": "Who last updated this version",
168
+ "properties": {
169
+ "id": {
170
+ "type": "string",
171
+ "description": "Unique identifier for the author",
172
+ "title": "Id"
173
+ },
174
+ "displayName": {
175
+ "type": "string",
176
+ "description": "Human-readable name of the author",
177
+ "title": "Display Name"
178
+ }
179
+ },
180
+ "required": [
181
+ "id",
182
+ "displayName"
183
+ ],
184
+ "additionalProperties": false,
185
+ "title": "Updated By"
186
+ }
187
+ },
188
+ "required": [
189
+ "createdAt",
190
+ "createdBy",
191
+ "updatedAt",
192
+ "updatedBy"
193
+ ],
194
+ "additionalProperties": false,
195
+ "title": "Draft"
196
+ },
197
+ "live": {
198
+ "type": "object",
199
+ "description": "Metadata for the published version",
200
+ "properties": {
201
+ "createdAt": {
202
+ "type": "string",
203
+ "description": "When this version was first created",
204
+ "format": "date-time",
205
+ "title": "Created At"
206
+ },
207
+ "createdBy": {
208
+ "type": "object",
209
+ "description": "Who created this version",
210
+ "properties": {
211
+ "id": {
212
+ "type": "string",
213
+ "description": "Unique identifier for the author",
214
+ "title": "Id"
215
+ },
216
+ "displayName": {
217
+ "type": "string",
218
+ "description": "Human-readable name of the author",
219
+ "title": "Display Name"
220
+ }
221
+ },
222
+ "required": [
223
+ "id",
224
+ "displayName"
225
+ ],
226
+ "additionalProperties": false,
227
+ "title": "Created By"
228
+ },
229
+ "updatedAt": {
230
+ "type": "string",
231
+ "description": "When this version was last updated",
232
+ "format": "date-time",
233
+ "title": "Updated At"
234
+ },
235
+ "updatedBy": {
236
+ "type": "object",
237
+ "description": "Who last updated this version",
238
+ "properties": {
239
+ "id": {
240
+ "type": "string",
241
+ "description": "Unique identifier for the author",
242
+ "title": "Id"
243
+ },
244
+ "displayName": {
245
+ "type": "string",
246
+ "description": "Human-readable name of the author",
247
+ "title": "Display Name"
248
+ }
249
+ },
250
+ "required": [
251
+ "id",
252
+ "displayName"
253
+ ],
254
+ "additionalProperties": false,
255
+ "title": "Updated By"
256
+ }
257
+ },
258
+ "required": [
259
+ "createdAt",
260
+ "createdBy",
261
+ "updatedAt",
262
+ "updatedBy"
263
+ ],
264
+ "additionalProperties": false,
265
+ "title": "Live"
266
+ },
267
+ "createdAt": {
268
+ "type": "string",
269
+ "description": "When the form was first created",
270
+ "format": "date-time",
271
+ "title": "Created At"
272
+ },
273
+ "createdBy": {
274
+ "type": "object",
275
+ "description": "Who created the form",
276
+ "properties": {
277
+ "id": {
278
+ "type": "string",
279
+ "description": "Unique identifier for the author",
280
+ "title": "Id"
281
+ },
282
+ "displayName": {
283
+ "type": "string",
284
+ "description": "Human-readable name of the author",
285
+ "title": "Display Name"
286
+ }
287
+ },
288
+ "required": [
289
+ "id",
290
+ "displayName"
291
+ ],
292
+ "additionalProperties": false,
293
+ "title": "Created By"
294
+ },
295
+ "updatedAt": {
296
+ "type": "string",
297
+ "description": "When the form was last updated",
298
+ "format": "date-time",
299
+ "title": "Updated At"
300
+ },
301
+ "updatedBy": {
302
+ "type": "object",
303
+ "description": "Who last updated the form",
304
+ "properties": {
305
+ "id": {
306
+ "type": "string",
307
+ "description": "Unique identifier for the author",
308
+ "title": "Id"
309
+ },
310
+ "displayName": {
311
+ "type": "string",
312
+ "description": "Human-readable name of the author",
313
+ "title": "Display Name"
314
+ }
315
+ },
316
+ "required": [
317
+ "id",
318
+ "displayName"
319
+ ],
320
+ "additionalProperties": false,
321
+ "title": "Updated By"
322
+ }
323
+ },
324
+ "required": [
325
+ "title",
326
+ "organisation",
327
+ "teamName",
328
+ "teamEmail",
329
+ "id",
330
+ "slug",
331
+ "createdAt",
332
+ "createdBy",
333
+ "updatedAt",
334
+ "updatedBy"
335
+ ],
336
+ "additionalProperties": false,
337
+ "$schema": "http://json-schema.org/draft-07/schema#",
338
+ "title": "Form Metadata Schema",
339
+ "$id": "@defra/forms-model/schemas/form-metadata-schema.json"
340
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "type": "object",
3
+ "description": "Metadata about a specific version state (draft or live)",
4
+ "properties": {
5
+ "createdAt": {
6
+ "type": "string",
7
+ "description": "When this version was first created",
8
+ "format": "date-time",
9
+ "title": "Created At"
10
+ },
11
+ "createdBy": {
12
+ "type": "object",
13
+ "description": "Who created this version",
14
+ "properties": {
15
+ "id": {
16
+ "type": "string",
17
+ "description": "Unique identifier for the author",
18
+ "title": "Id"
19
+ },
20
+ "displayName": {
21
+ "type": "string",
22
+ "description": "Human-readable name of the author",
23
+ "title": "Display Name"
24
+ }
25
+ },
26
+ "required": [
27
+ "id",
28
+ "displayName"
29
+ ],
30
+ "additionalProperties": false,
31
+ "title": "Created By"
32
+ },
33
+ "updatedAt": {
34
+ "type": "string",
35
+ "description": "When this version was last updated",
36
+ "format": "date-time",
37
+ "title": "Updated At"
38
+ },
39
+ "updatedBy": {
40
+ "type": "object",
41
+ "description": "Who last updated this version",
42
+ "properties": {
43
+ "id": {
44
+ "type": "string",
45
+ "description": "Unique identifier for the author",
46
+ "title": "Id"
47
+ },
48
+ "displayName": {
49
+ "type": "string",
50
+ "description": "Human-readable name of the author",
51
+ "title": "Display Name"
52
+ }
53
+ },
54
+ "required": [
55
+ "id",
56
+ "displayName"
57
+ ],
58
+ "additionalProperties": false,
59
+ "title": "Updated By"
60
+ }
61
+ },
62
+ "required": [
63
+ "createdAt",
64
+ "createdBy",
65
+ "updatedAt",
66
+ "updatedBy"
67
+ ],
68
+ "additionalProperties": false,
69
+ "$schema": "http://json-schema.org/draft-07/schema#",
70
+ "title": "Form Metadata State Schema",
71
+ "$id": "@defra/forms-model/schemas/form-metadata-state-schema.json"
72
+ }
@@ -0,0 +1,124 @@
1
+ {
2
+ "type": "object",
3
+ "description": "Complete form submission payload structure with all form data",
4
+ "properties": {
5
+ "retrievalKey": {
6
+ "type": "string",
7
+ "description": "Unique key to retrieve this submission later",
8
+ "title": "Retrieval Key"
9
+ },
10
+ "sessionId": {
11
+ "type": "string",
12
+ "description": "User session identifier for tracking and security",
13
+ "title": "Session Id"
14
+ },
15
+ "main": {
16
+ "type": "array",
17
+ "description": "Main (non-repeating) field values from the form",
18
+ "items": {
19
+ "type": "object",
20
+ "description": "Individual field value in a form submission",
21
+ "properties": {
22
+ "name": {
23
+ "type": "string",
24
+ "description": "Field identifier matching the component name",
25
+ "title": "Name"
26
+ },
27
+ "title": {
28
+ "type": "string",
29
+ "description": "Human-readable label for the field",
30
+ "title": "Title"
31
+ },
32
+ "value": {
33
+ "type": "string",
34
+ "description": "User-submitted value for the field, may be empty",
35
+ "title": "Value"
36
+ }
37
+ },
38
+ "required": [
39
+ "name",
40
+ "title",
41
+ "value"
42
+ ],
43
+ "additionalProperties": false,
44
+ "title": "Main Item"
45
+ },
46
+ "title": "Main"
47
+ },
48
+ "repeaters": {
49
+ "type": "array",
50
+ "description": "Repeatable section values from the form",
51
+ "items": {
52
+ "type": "object",
53
+ "description": "Collection of repeated field values from a repeatable section",
54
+ "properties": {
55
+ "name": {
56
+ "type": "string",
57
+ "description": "Identifier for the repeatable section",
58
+ "title": "Name"
59
+ },
60
+ "title": {
61
+ "type": "string",
62
+ "description": "Human-readable title for the repeatable section",
63
+ "title": "Title"
64
+ },
65
+ "value": {
66
+ "type": "array",
67
+ "description": "Array of record arrays, each representing a repeated instance",
68
+ "items": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "object",
72
+ "description": "Individual field value in a form submission",
73
+ "properties": {
74
+ "name": {
75
+ "type": "string",
76
+ "description": "Field identifier matching the component name",
77
+ "title": "Name"
78
+ },
79
+ "title": {
80
+ "type": "string",
81
+ "description": "Human-readable label for the field",
82
+ "title": "Title"
83
+ },
84
+ "value": {
85
+ "type": "string",
86
+ "description": "User-submitted value for the field, may be empty",
87
+ "title": "Value"
88
+ }
89
+ },
90
+ "required": [
91
+ "name",
92
+ "title",
93
+ "value"
94
+ ],
95
+ "additionalProperties": false,
96
+ "title": "Value Item Item"
97
+ },
98
+ "title": "Value Item"
99
+ },
100
+ "title": "Value"
101
+ }
102
+ },
103
+ "required": [
104
+ "name",
105
+ "title",
106
+ "value"
107
+ ],
108
+ "additionalProperties": false,
109
+ "title": "Repeaters Item"
110
+ },
111
+ "title": "Repeaters"
112
+ }
113
+ },
114
+ "required": [
115
+ "retrievalKey",
116
+ "sessionId",
117
+ "main",
118
+ "repeaters"
119
+ ],
120
+ "additionalProperties": false,
121
+ "$schema": "http://json-schema.org/draft-07/schema#",
122
+ "title": "Form Submit Payload Schema",
123
+ "$id": "@defra/forms-model/schemas/form-submit-payload-schema.json"
124
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "type": "object",
3
+ "description": "Individual field value in a form submission",
4
+ "properties": {
5
+ "name": {
6
+ "type": "string",
7
+ "description": "Field identifier matching the component name",
8
+ "title": "Name"
9
+ },
10
+ "title": {
11
+ "type": "string",
12
+ "description": "Human-readable label for the field",
13
+ "title": "Title"
14
+ },
15
+ "value": {
16
+ "type": "string",
17
+ "description": "User-submitted value for the field, may be empty",
18
+ "title": "Value"
19
+ }
20
+ },
21
+ "required": [
22
+ "name",
23
+ "title",
24
+ "value"
25
+ ],
26
+ "additionalProperties": false,
27
+ "$schema": "http://json-schema.org/draft-07/schema#",
28
+ "title": "Form Submit Record Schema",
29
+ "$id": "@defra/forms-model/schemas/form-submit-record-schema.json"
30
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "type": "object",
3
+ "description": "Collection of repeated field values from a repeatable section",
4
+ "properties": {
5
+ "name": {
6
+ "type": "string",
7
+ "description": "Identifier for the repeatable section",
8
+ "title": "Name"
9
+ },
10
+ "title": {
11
+ "type": "string",
12
+ "description": "Human-readable title for the repeatable section",
13
+ "title": "Title"
14
+ },
15
+ "value": {
16
+ "type": "array",
17
+ "description": "Array of record arrays, each representing a repeated instance",
18
+ "items": {
19
+ "type": "array",
20
+ "items": {
21
+ "type": "object",
22
+ "description": "Individual field value in a form submission",
23
+ "properties": {
24
+ "name": {
25
+ "type": "string",
26
+ "description": "Field identifier matching the component name",
27
+ "title": "Name"
28
+ },
29
+ "title": {
30
+ "type": "string",
31
+ "description": "Human-readable label for the field",
32
+ "title": "Title"
33
+ },
34
+ "value": {
35
+ "type": "string",
36
+ "description": "User-submitted value for the field, may be empty",
37
+ "title": "Value"
38
+ }
39
+ },
40
+ "required": [
41
+ "name",
42
+ "title",
43
+ "value"
44
+ ],
45
+ "additionalProperties": false,
46
+ "title": "Value Item Item"
47
+ },
48
+ "title": "Value Item"
49
+ },
50
+ "title": "Value"
51
+ }
52
+ },
53
+ "required": [
54
+ "name",
55
+ "title",
56
+ "value"
57
+ ],
58
+ "additionalProperties": false,
59
+ "$schema": "http://json-schema.org/draft-07/schema#",
60
+ "title": "Form Submit Recordset Schema",
61
+ "$id": "@defra/forms-model/schemas/form-submit-recordset-schema.json"
62
+ }