@defra/forms-model 3.0.382 → 3.0.384
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/module/form/utils/index.js +0 -1
- package/dist/module/form/utils/index.js.map +1 -1
- package/dist/types/form/utils/index.d.ts +0 -1
- package/dist/types/form/utils/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/form/utils/index.ts +0 -1
- package/dist/module/form/utils/update-start-page.js +0 -28
- package/dist/module/form/utils/update-start-page.js.map +0 -1
- package/dist/types/form/utils/update-start-page.d.ts +0 -7
- package/dist/types/form/utils/update-start-page.d.ts.map +0 -1
- package/src/form/utils/update-start-page.ts +0 -26
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["findStartPage"
|
1
|
+
{"version":3,"file":"index.js","names":["findStartPage"],"sources":["../../../../src/form/utils/index.ts"],"sourcesContent":["export { findStartPage } from '~/src/form/utils/find-start-page.js'\n"],"mappings":"AAAA,SAASA,aAAa","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@defra/forms-model",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.384",
|
4
4
|
"description": "A hapi plugin providing the model for Defra forms",
|
5
5
|
"homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
|
6
6
|
"repository": {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"joi": "^17.0.0"
|
34
34
|
},
|
35
35
|
"engines": {
|
36
|
-
"node": "^
|
37
|
-
"npm": "^10.
|
36
|
+
"node": "^22.11.0",
|
37
|
+
"npm": "^10.9.0"
|
38
38
|
}
|
39
39
|
}
|
package/src/form/utils/index.ts
CHANGED
@@ -1,28 +0,0 @@
|
|
1
|
-
import { findStartPage } from "./find-start-page.js";
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Update start page when pages are modified
|
5
|
-
* @param data - Form definition
|
6
|
-
*/
|
7
|
-
export function updateStartPage(data) {
|
8
|
-
const startPage = findStartPage(data);
|
9
|
-
|
10
|
-
// Update start page if incorrect
|
11
|
-
if (startPage && (!data.startPage || data.startPage !== startPage)) {
|
12
|
-
return {
|
13
|
-
...structuredClone(data),
|
14
|
-
startPage
|
15
|
-
};
|
16
|
-
}
|
17
|
-
|
18
|
-
// Remove start page if no pages exist
|
19
|
-
if (!startPage && 'startPage' in data) {
|
20
|
-
const definition = structuredClone(data);
|
21
|
-
|
22
|
-
// Remove without modifying original
|
23
|
-
delete definition.startPage;
|
24
|
-
return definition;
|
25
|
-
}
|
26
|
-
return data;
|
27
|
-
}
|
28
|
-
//# sourceMappingURL=update-start-page.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"update-start-page.js","names":["findStartPage","updateStartPage","data","startPage","structuredClone","definition"],"sources":["../../../../src/form/utils/update-start-page.ts"],"sourcesContent":["import { type FormDefinition } from '~/src/form/form-definition/types.js'\nimport { findStartPage } from '~/src/form/utils/find-start-page.js'\n\n/**\n * Update start page when pages are modified\n * @param data - Form definition\n */\nexport function updateStartPage(data: FormDefinition) {\n const startPage = findStartPage(data)\n\n // Update start page if incorrect\n if (startPage && (!data.startPage || data.startPage !== startPage)) {\n return { ...structuredClone(data), startPage }\n }\n\n // Remove start page if no pages exist\n if (!startPage && 'startPage' in data) {\n const definition = structuredClone(data)\n\n // Remove without modifying original\n delete definition.startPage\n return definition\n }\n\n return data\n}\n"],"mappings":"AACA,SAASA,aAAa;;AAEtB;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACC,IAAoB,EAAE;EACpD,MAAMC,SAAS,GAAGH,aAAa,CAACE,IAAI,CAAC;;EAErC;EACA,IAAIC,SAAS,KAAK,CAACD,IAAI,CAACC,SAAS,IAAID,IAAI,CAACC,SAAS,KAAKA,SAAS,CAAC,EAAE;IAClE,OAAO;MAAE,GAAGC,eAAe,CAACF,IAAI,CAAC;MAAEC;IAAU,CAAC;EAChD;;EAEA;EACA,IAAI,CAACA,SAAS,IAAI,WAAW,IAAID,IAAI,EAAE;IACrC,MAAMG,UAAU,GAAGD,eAAe,CAACF,IAAI,CAAC;;IAExC;IACA,OAAOG,UAAU,CAACF,SAAS;IAC3B,OAAOE,UAAU;EACnB;EAEA,OAAOH,IAAI;AACb","ignoreList":[]}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { type FormDefinition } from '../../form/form-definition/types.js';
|
2
|
-
/**
|
3
|
-
* Update start page when pages are modified
|
4
|
-
* @param data - Form definition
|
5
|
-
*/
|
6
|
-
export declare function updateStartPage(data: FormDefinition): FormDefinition;
|
7
|
-
//# sourceMappingURL=update-start-page.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"update-start-page.d.ts","sourceRoot":"","sources":["../../../../src/form/utils/update-start-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAGzE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,kBAkBnD"}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { type FormDefinition } from '~/src/form/form-definition/types.js'
|
2
|
-
import { findStartPage } from '~/src/form/utils/find-start-page.js'
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Update start page when pages are modified
|
6
|
-
* @param data - Form definition
|
7
|
-
*/
|
8
|
-
export function updateStartPage(data: FormDefinition) {
|
9
|
-
const startPage = findStartPage(data)
|
10
|
-
|
11
|
-
// Update start page if incorrect
|
12
|
-
if (startPage && (!data.startPage || data.startPage !== startPage)) {
|
13
|
-
return { ...structuredClone(data), startPage }
|
14
|
-
}
|
15
|
-
|
16
|
-
// Remove start page if no pages exist
|
17
|
-
if (!startPage && 'startPage' in data) {
|
18
|
-
const definition = structuredClone(data)
|
19
|
-
|
20
|
-
// Remove without modifying original
|
21
|
-
delete definition.startPage
|
22
|
-
return definition
|
23
|
-
}
|
24
|
-
|
25
|
-
return data
|
26
|
-
}
|