@defra/forms-model 3.0.431 → 3.0.432
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/package.json +1 -1
- package/schemas/component-schema-v2.json +162 -0
- package/schemas/component-schema.json +162 -0
- package/schemas/date-sub-schema.json +11 -0
- package/schemas/form-definition-schema.json +1876 -0
- package/schemas/form-definition-v2-payload-schema.json +1459 -0
- package/schemas/form-editor-input-check-answers-setting-schema.json +18 -0
- package/schemas/form-editor-input-page-schema.json +41 -0
- package/schemas/form-editor-input-page-settings-schema.json +28 -0
- package/schemas/form-editor-input-question-schema.json +38 -0
- package/schemas/form-metadata-author-schema.json +24 -0
- package/schemas/form-metadata-contact-schema.json +61 -0
- package/schemas/form-metadata-email-schema.json +25 -0
- package/schemas/form-metadata-input-schema.json +127 -0
- package/schemas/form-metadata-online-schema.json +25 -0
- package/schemas/form-metadata-schema.json +340 -0
- package/schemas/form-metadata-state-schema.json +72 -0
- package/schemas/form-submit-payload-schema.json +124 -0
- package/schemas/form-submit-record-schema.json +30 -0
- package/schemas/form-submit-recordset-schema.json +62 -0
- package/schemas/list-schema-v2.json +486 -0
- package/schemas/list-schema.json +486 -0
- package/schemas/max-future-schema.json +8 -0
- package/schemas/max-length-schema.json +8 -0
- package/schemas/max-past-schema.json +8 -0
- package/schemas/max-schema.json +7 -0
- package/schemas/min-length-schema.json +8 -0
- package/schemas/min-schema.json +7 -0
- package/schemas/page-schema-payload-v2.json +400 -0
- package/schemas/page-schema-v2.json +400 -0
- package/schemas/page-schema.json +400 -0
- package/schemas/page-type-schema.json +11 -0
- package/schemas/pagination-options-schema.json +27 -0
- package/schemas/patch-page-schema.json +26 -0
- package/schemas/query-options-schema.json +94 -0
- package/schemas/question-schema.json +7 -0
- package/schemas/question-type-full-schema.json +22 -0
- package/schemas/question-type-schema.json +20 -0
- package/schemas/search-options-schema.json +59 -0
- package/schemas/sorting-options-schema.json +28 -0
- package/schemas/written-answer-sub-schema.json +12 -0
- package/scripts/generate-schemas.js +0 -238
- package/scripts/schema-modules/constants.js +0 -39
- package/scripts/schema-modules/schema-processors.js +0 -109
- package/scripts/schema-modules/schema-simplifiers.js +0 -351
- package/scripts/schema-modules/title-processors.js +0 -327
- package/scripts/schema-modules/types.js +0 -21
- package/scripts/schema-modules/utils.js +0 -41
@@ -1,41 +0,0 @@
|
|
1
|
-
import fs from 'fs'
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Ensures a directory exists
|
5
|
-
* @param {string} dir Directory path
|
6
|
-
*/
|
7
|
-
export function ensureDirectoryExists(dir) {
|
8
|
-
if (!fs.existsSync(dir)) {
|
9
|
-
fs.mkdirSync(dir, { recursive: true })
|
10
|
-
}
|
11
|
-
}
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Formats a kebab-case string to Title Case
|
15
|
-
* @param {string} str String to format
|
16
|
-
* @returns {string} Formatted string
|
17
|
-
*/
|
18
|
-
export function toTitleCase(str) {
|
19
|
-
return str
|
20
|
-
.split('-')
|
21
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
22
|
-
.join(' ')
|
23
|
-
}
|
24
|
-
|
25
|
-
/**
|
26
|
-
* Format camelCase or snake_case to Title Case
|
27
|
-
* @param {string} str String to format
|
28
|
-
* @returns {string} Formatted string
|
29
|
-
*/
|
30
|
-
export function formatPropertyName(str) {
|
31
|
-
return (
|
32
|
-
str
|
33
|
-
// camelCase to space-separated
|
34
|
-
.replace(/([A-Z])/g, ' $1')
|
35
|
-
// snake_case to space-separated
|
36
|
-
.replace(/_/g, ' ')
|
37
|
-
// Capitalize first letter
|
38
|
-
.replace(/^./, (first) => first.toUpperCase())
|
39
|
-
.trim()
|
40
|
-
)
|
41
|
-
}
|