@defra/forms-model 3.0.593 → 3.0.594

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.
@@ -130,4 +130,25 @@ export const summaryPageControllers = [ControllerType.Summary, ControllerType.Su
130
130
  export function isSummaryPage(page) {
131
131
  return summaryPageControllers.includes(page?.controller ?? ControllerType.Page);
132
132
  }
133
+
134
+ /**
135
+ * Revert any custom controllers to their parent/base class since engine-plugin has no knowledge of them
136
+ * @param {FormDefinition} definition
137
+ * @returns {FormDefinition}
138
+ */
139
+ export function replaceCustomControllers(definition) {
140
+ const standardControllers = new Set(Object.values(ControllerType).filter(x => x !== ControllerType.SummaryWithConfirmationEmail).map(x => x.toString()));
141
+ return {
142
+ ...definition,
143
+ pages: definition.pages.map(page => {
144
+ if (!standardControllers.has((page.controller ?? ControllerType.Page).toString())) {
145
+ return /** @type {Page} */{
146
+ ...page,
147
+ controller: ControllerType.Page
148
+ };
149
+ }
150
+ return page;
151
+ })
152
+ };
153
+ }
133
154
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["ComponentType","hasFormField","isFormType","ControllerNames","ControllerTypes","ControllerType","PageTypes","getPageDefaults","page","nameOrPath","controller","Page","controllerNameFromPath","defaults","find","pageType","Error","structuredClone","hasComponents","hasNext","Array","isArray","components","hasComponentsEvenIfNoNext","undefined","hasFormComponents","Start","hasRepeater","Repeat","isControllerName","map","String","includes","Terminal","FileUpload","options","path","name","includesFileUploadField","some","component","type","FileUploadField","onlyDeclarationComponents","filter","comp","every","DeclarationField","SHOW_REPEATER_CONTROLLERS","showRepeaterSettings","getPageTitle","title","firstComp","getPageFromDefinition","definition","pageId","pages","x","id","summaryPageControllers","Summary","SummaryWithConfirmationEmail","isSummaryPage"],"sources":["../../../src/pages/helpers.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { hasFormField, isFormType } from '~/src/components/helpers.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n type Link,\n type Page,\n type PageFileUpload,\n type PageQuestion,\n type PageRepeat\n} from '~/src/form/form-definition/types.js'\nimport { type FormDefinition } from '~/src/index.js'\nimport {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\nimport { ControllerType } from '~/src/pages/enums.js'\nimport { PageTypes } from '~/src/pages/page-types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getPageDefaults<PageType extends Page>(\n page?: Pick<PageType, 'controller'>\n) {\n const nameOrPath = page?.controller ?? ControllerType.Page\n const controller = controllerNameFromPath(nameOrPath)\n\n const defaults = PageTypes.find(\n (pageType) => pageType.controller === controller\n )\n\n if (!defaults) {\n throw new Error(`Defaults not found for page type '${nameOrPath}'`)\n }\n\n return structuredClone(defaults) as PageType\n}\n\n/**\n * Check page has components\n */\nexport function hasComponents(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return hasNext(page) && Array.isArray(page.components)\n}\n\n/**\n * Check if the page has components (the page can be any page type e.g. SummaryPage)\n */\nexport function hasComponentsEvenIfNoNext(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return (\n page !== undefined && 'components' in page && Array.isArray(page.components)\n )\n}\n\n/**\n * Check page has form components\n */\nexport function hasFormComponents(\n page?: Partial<Page>\n): page is PageQuestion | PageFileUpload {\n const controller = controllerNameFromPath(page?.controller)\n return hasComponents(page) && controller !== ControllerType.Start\n}\n\n/**\n * Check page has repeater\n */\nexport function hasRepeater(page?: Partial<Page>): page is PageRepeat {\n return controllerNameFromPath(page?.controller) === ControllerType.Repeat\n}\n\n/**\n * Check for known page controller names\n */\nexport function isControllerName(\n nameOrPath?: ControllerType | string\n): nameOrPath is ControllerType {\n return !!nameOrPath && ControllerNames.map(String).includes(nameOrPath)\n}\n\n/**\n * Check page has next link\n */\nexport function hasNext(\n page?: Partial<Page>\n): page is Extract<Page, { next: Link[] }> {\n if (!page || !('next' in page)) {\n return false\n }\n\n const controller = controllerNameFromPath(page.controller)\n\n return (\n !controller ||\n controller === ControllerType.Start ||\n controller === ControllerType.Page ||\n controller === ControllerType.Terminal ||\n controller === ControllerType.FileUpload ||\n controller === ControllerType.Repeat\n )\n}\n\n/**\n * Check and optionally replace legacy path with controller name\n * @param {string} [nameOrPath] - Controller name or legacy controller path\n */\nexport function controllerNameFromPath(nameOrPath?: ControllerType | string) {\n if (isControllerName(nameOrPath)) {\n return nameOrPath\n }\n\n const options = ControllerTypes.find(({ path }) => path === nameOrPath)\n return options?.name\n}\n\nexport function includesFileUploadField(components: ComponentDef[]): boolean {\n return components.some(\n (component) => component.type === ComponentType.FileUploadField\n )\n}\n\nexport function onlyDeclarationComponents(components: ComponentDef[]): boolean {\n return components\n .filter((comp) => isFormType(comp.type))\n .every((component) => component.type === ComponentType.DeclarationField)\n}\n\nconst SHOW_REPEATER_CONTROLLERS = [ControllerType.Page, ControllerType.Repeat]\n\nexport function showRepeaterSettings(page: Page): boolean {\n if (page.controller && !SHOW_REPEATER_CONTROLLERS.includes(page.controller)) {\n return false\n }\n if (hasComponents(page)) {\n if (includesFileUploadField(page.components)) {\n return false\n }\n if (onlyDeclarationComponents(page.components)) {\n return false\n }\n }\n return true\n}\n\n/**\n * Gets page title, or title of first question (if no page title set)\n * @param {Page} page\n * @returns {string}\n */\nexport function getPageTitle(page: Page) {\n if (page.title !== '') {\n return page.title\n }\n\n if (hasComponentsEvenIfNoNext(page)) {\n const firstComp = page.components.find(hasFormField)\n if (firstComp) {\n return firstComp.title\n }\n }\n return 'Page title unknown'\n}\n\n/**\n *\n * @param {FormDefinition} definition\n * @param {string} pageId\n * @returns { Page | undefined }\n */\nexport function getPageFromDefinition(\n definition: FormDefinition,\n pageId: string\n): Page | undefined {\n return definition.pages.find((x) => x.id === pageId)\n}\n\nexport const summaryPageControllers = [\n ControllerType.Summary,\n ControllerType.SummaryWithConfirmationEmail\n]\n\nexport function isSummaryPage(page: Page | undefined) {\n return summaryPageControllers.includes(\n page?.contro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KAAKH,MAAM,CAAC;AACtD;AAEA,OAAO,MAAMI,sBAAsB,GAAG,CACpCtD,cAAc,CAACuD,OAAO,EACtBvD,cAAc,CAACwD,4BAA4B,CAC5C;AAED,OAAO,SAASC,aAAaA,CAACtD,IAAsB,EAAE;EACpD,OAAOmD,sBAAsB,CAAC3B,QAAQ,CACpCxB,IAAI,EAAEE,UAAU,IAAIL,cAAc,CAACM,IACrC,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"helpers.js","names":["ComponentType","hasFormField","isFormType","ControllerNames","ControllerTypes","ControllerType","PageTypes","getPageDefaults","page","nameOrPath","controller","Page","controllerNameFromPath","defaults","find","pageType","Error","structuredClone","hasComponents","hasNext","Array","isArray","components","hasComponentsEvenIfNoNext","undefined","hasFormComponents","Start","hasRepeater","Repeat","isControllerName","map","String","includes","Terminal","FileUpload","options","path","name","includesFileUploadField","some","component","type","FileUploadField","onlyDeclarationComponents","filter","comp","every","DeclarationField","SHOW_REPEATER_CONTROLLERS","showRepeaterSettings","getPageTitle","title","firstComp","getPageFromDefinition","definition","pageId","pages","x","id","summaryPageControllers","Summary","SummaryWithConfirmationEmail","isSummaryPage","replaceCustomControllers","standardControllers","Set","Object","values","toString","has"],"sources":["../../../src/pages/helpers.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { hasFormField, isFormType } from '~/src/components/helpers.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n type Link,\n type Page,\n type PageFileUpload,\n type PageQuestion,\n type PageRepeat\n} from '~/src/form/form-definition/types.js'\nimport { type FormDefinition } from '~/src/index.js'\nimport {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\nimport { ControllerType } from '~/src/pages/enums.js'\nimport { PageTypes } from '~/src/pages/page-types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getPageDefaults<PageType extends Page>(\n page?: Pick<PageType, 'controller'>\n) {\n const nameOrPath = page?.controller ?? ControllerType.Page\n const controller = controllerNameFromPath(nameOrPath)\n\n const defaults = PageTypes.find(\n (pageType) => pageType.controller === controller\n )\n\n if (!defaults) {\n throw new Error(`Defaults not found for page type '${nameOrPath}'`)\n }\n\n return structuredClone(defaults) as PageType\n}\n\n/**\n * Check page has components\n */\nexport function hasComponents(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return hasNext(page) && Array.isArray(page.components)\n}\n\n/**\n * Check if the page has components (the page can be any page type e.g. SummaryPage)\n */\nexport function hasComponentsEvenIfNoNext(\n page?: Partial<Page>\n): page is Extract<Page, { components: ComponentDef[] }> {\n return (\n page !== undefined && 'components' in page && Array.isArray(page.components)\n )\n}\n\n/**\n * Check page has form components\n */\nexport function hasFormComponents(\n page?: Partial<Page>\n): page is PageQuestion | PageFileUpload {\n const controller = controllerNameFromPath(page?.controller)\n return hasComponents(page) && controller !== ControllerType.Start\n}\n\n/**\n * Check page has repeater\n */\nexport function hasRepeater(page?: Partial<Page>): page is PageRepeat {\n return controllerNameFromPath(page?.controller) === ControllerType.Repeat\n}\n\n/**\n * Check for known page controller names\n */\nexport function isControllerName(\n nameOrPath?: ControllerType | string\n): nameOrPath is ControllerType {\n return !!nameOrPath && ControllerNames.map(String).includes(nameOrPath)\n}\n\n/**\n * Check page has next link\n */\nexport function hasNext(\n page?: Partial<Page>\n): page is Extract<Page, { next: Link[] }> {\n if (!page || !('next' in page)) {\n return false\n }\n\n const controller = controllerNameFromPath(page.controller)\n\n return (\n !controller ||\n controller === ControllerType.Start ||\n controller === ControllerType.Page ||\n controller === ControllerType.Terminal ||\n controller === ControllerType.FileUpload ||\n controller === ControllerType.Repeat\n )\n}\n\n/**\n * Check and optionally replace legacy path with controller name\n * @param {string} [nameOrPath] - Controller name or legacy controller path\n */\nexport function controllerNameFromPath(nameOrPath?: ControllerType | string) {\n if (isControllerName(nameOrPath)) {\n return nameOrPath\n }\n\n const options = ControllerTypes.find(({ path }) => path === nameOrPath)\n return options?.name\n}\n\nexport function includesFileUploadField(components: ComponentDef[]): boolean {\n return components.some(\n (component) => component.type === ComponentType.FileUploadField\n )\n}\n\nexport function onlyDeclarationComponents(components: ComponentDef[]): boolean {\n return components\n .filter((comp) => isFormType(comp.type))\n .every((component) => component.type === ComponentType.DeclarationField)\n}\n\nconst SHOW_REPEATER_CONTROLLERS = [ControllerType.Page, ControllerType.Repeat]\n\nexport function showRepeaterSettings(page: Page): boolean {\n if (page.controller && !SHOW_REPEATER_CONTROLLERS.includes(page.controller)) {\n return false\n }\n if (hasComponents(page)) {\n if (includesFileUploadField(page.components)) {\n return false\n }\n if (onlyDeclarationComponents(page.components)) {\n return false\n }\n }\n return true\n}\n\n/**\n * Gets page title, or title of first question (if no page title set)\n * @param {Page} page\n * @returns {string}\n */\nexport function getPageTitle(page: Page) {\n if (page.title !== '') {\n return page.title\n }\n\n if (hasComponentsEvenIfNoNext(page)) {\n const firstComp = page.components.find(hasFormField)\n if (firstComp) {\n return firstComp.title\n }\n }\n return 'Page title unknown'\n}\n\n/**\n *\n * @param {FormDefinition} definition\n * @param {string} pageId\n * @returns { Page | undefined }\n */\nexport function getPageFromDefinition(\n definition: FormDefinition,\n pageId: string\n): Page | undefined {\n return definition.pages.find((x) => x.id === pageId)\n}\n\nexport const summaryPageControllers = [\n ControllerType.Summary,\n ControllerType.SummaryWithConfirmationEmail\n]\n\nexport function isSummaryPage(page: Page | undefined) {\n return summaryPageControllers.includes(\n page?.controller ?? ControllerType.Page\n )\n}\n\n/**\n * Revert any custom controllers to their parent/base class since engine-plugin has no knowledge of them\n * @param {FormDefinition} definition\n * @returns {FormDefinition}\n */\nexport function replaceCustomControllers(definition: FormDefinition) {\n const standardControllers = new Set(\n Object.values(ControllerType)\n .filter((x) => x !== ControllerType.SummaryWithConfirmationEmail)\n .map((x) => x.toString())\n )\n\n return {\n ...definition,\n pages: definition.pages.map((page) => {\n if (\n !standardControllers.has(\n (page.controller ?? ControllerType.Page).toString()\n )\n ) {\n return /** @type {Page} */ {\n ...page,\n controller: ControllerType.Page\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C,EAAE,KAAKH,MAAM,CAAC;AACtD;AAEA,OAAO,MAAMI,sBAAsB,GAAG,CACpCtD,cAAc,CAACuD,OAAO,EACtBvD,cAAc,CAACwD,4BAA4B,CAC5C;AAED,OAAO,SAASC,aAAaA,CAACtD,IAAsB,EAAE;EACpD,OAAOmD,sBAAsB,CAAC3B,QAAQ,CACpCxB,IAAI,EAAEE,UAAU,IAAIL,cAAc,CAACM,IACrC,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASoD,wBAAwBA,CAACT,UAA0B,EAAE;EACnE,MAAMU,mBAAmB,GAAG,IAAIC,GAAG,CACjCC,MAAM,CAACC,MAAM,CAAC9D,cAAc,CAAC,CAC1BuC,MAAM,CAAEa,CAAC,IAAKA,CAAC,KAAKpD,cAAc,CAACwD,4BAA4B,CAAC,CAChE/B,GAAG,CAAE2B,CAAC,IAAKA,CAAC,CAACW,QAAQ,CAAC,CAAC,CAC5B,CAAC;EAED,OAAO;IACL,GAAGd,UAAU;IACbE,KAAK,EAAEF,UAAU,CAACE,KAAK,CAAC1B,GAAG,CAAEtB,IAAI,IAAK;MACpC,IACE,CAACwD,mBAAmB,CAACK,GAAG,CACtB,CAAC7D,IAAI,CAACE,UAAU,IAAIL,cAAc,CAACM,IAAI,EAAEyD,QAAQ,CAAC,CACpD,CAAC,EACD;QACA,OAAO,mBAAoB;UACzB,GAAG5D,IAAI;UACPE,UAAU,EAAEL,cAAc,CAACM;QAC7B,CAAC;MACH;MACA,OAAOH,IAAI;IACb,CAAC;EACH,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  export { ControllerNames, ControllerTypes } from "./controller-types.js";
2
2
  export { PageTypes } from "./page-types.js";
3
- export { controllerNameFromPath, getPageDefaults, getPageFromDefinition, getPageTitle, hasComponents, hasComponentsEvenIfNoNext, hasFormComponents, hasNext, hasRepeater, includesFileUploadField, isControllerName, isSummaryPage, showRepeaterSettings, summaryPageControllers } from "./helpers.js";
3
+ export { controllerNameFromPath, getPageDefaults, getPageFromDefinition, getPageTitle, hasComponents, hasComponentsEvenIfNoNext, hasFormComponents, hasNext, hasRepeater, includesFileUploadField, isControllerName, isSummaryPage, replaceCustomControllers, showRepeaterSettings, summaryPageControllers } from "./helpers.js";
4
4
  export { ControllerPath, ControllerType } from "./enums.js";
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ControllerNames","ControllerTypes","PageTypes","controllerNameFromPath","getPageDefaults","getPageFromDefinition","getPageTitle","hasComponents","hasComponentsEvenIfNoNext","hasFormComponents","hasNext","hasRepeater","includesFileUploadField","isControllerName","isSummaryPage","showRepeaterSettings","summaryPageControllers","ControllerPath","ControllerType"],"sources":["../../../src/pages/index.ts"],"sourcesContent":["export {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\n\nexport { PageTypes } from '~/src/pages/page-types.js'\n\nexport {\n controllerNameFromPath,\n getPageDefaults,\n getPageFromDefinition,\n getPageTitle,\n hasComponents,\n hasComponentsEvenIfNoNext,\n hasFormComponents,\n hasNext,\n hasRepeater,\n includesFileUploadField,\n isControllerName,\n isSummaryPage,\n showRepeaterSettings,\n summaryPageControllers\n} from '~/src/pages/helpers.js'\n\nexport { ControllerPath, ControllerType } from '~/src/pages/enums.js'\n"],"mappings":"AAAA,SACEA,eAAe,EACfC,eAAe;AAGjB,SAASC,SAAS;AAElB,SACEC,sBAAsB,EACtBC,eAAe,EACfC,qBAAqB,EACrBC,YAAY,EACZC,aAAa,EACbC,yBAAyB,EACzBC,iBAAiB,EACjBC,OAAO,EACPC,WAAW,EACXC,uBAAuB,EACvBC,gBAAgB,EAChBC,aAAa,EACbC,oBAAoB,EACpBC,sBAAsB;AAGxB,SAASC,cAAc,EAAEC,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["ControllerNames","ControllerTypes","PageTypes","controllerNameFromPath","getPageDefaults","getPageFromDefinition","getPageTitle","hasComponents","hasComponentsEvenIfNoNext","hasFormComponents","hasNext","hasRepeater","includesFileUploadField","isControllerName","isSummaryPage","replaceCustomControllers","showRepeaterSettings","summaryPageControllers","ControllerPath","ControllerType"],"sources":["../../../src/pages/index.ts"],"sourcesContent":["export {\n ControllerNames,\n ControllerTypes\n} from '~/src/pages/controller-types.js'\n\nexport { PageTypes } from '~/src/pages/page-types.js'\n\nexport {\n controllerNameFromPath,\n getPageDefaults,\n getPageFromDefinition,\n getPageTitle,\n hasComponents,\n hasComponentsEvenIfNoNext,\n hasFormComponents,\n hasNext,\n hasRepeater,\n includesFileUploadField,\n isControllerName,\n isSummaryPage,\n replaceCustomControllers,\n showRepeaterSettings,\n summaryPageControllers\n} from '~/src/pages/helpers.js'\n\nexport { ControllerPath, ControllerType } from '~/src/pages/enums.js'\n"],"mappings":"AAAA,SACEA,eAAe,EACfC,eAAe;AAGjB,SAASC,SAAS;AAElB,SACEC,sBAAsB,EACtBC,eAAe,EACfC,qBAAqB,EACrBC,YAAY,EACZC,aAAa,EACbC,yBAAyB,EACzBC,iBAAiB,EACjBC,OAAO,EACPC,WAAW,EACXC,uBAAuB,EACvBC,gBAAgB,EAChBC,aAAa,EACbC,wBAAwB,EACxBC,oBAAoB,EACpBC,sBAAsB;AAGxB,SAASC,cAAc,EAAEC,cAAc","ignoreList":[]}
@@ -59,4 +59,10 @@ export declare function getPageTitle(page: Page): string;
59
59
  export declare function getPageFromDefinition(definition: FormDefinition, pageId: string): Page | undefined;
60
60
  export declare const summaryPageControllers: ControllerType[];
61
61
  export declare function isSummaryPage(page: Page | undefined): boolean;
62
+ /**
63
+ * Revert any custom controllers to their parent/base class since engine-plugin has no knowledge of them
64
+ * @param {FormDefinition} definition
65
+ * @returns {FormDefinition}
66
+ */
67
+ export declare function replaceCustomControllers(definition: FormDefinition): FormDefinition;
62
68
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/pages/helpers.ts"],"names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E,cAAc,EAC1B,MAAM,EAAE,MAAM,GACb,IAAI,GAAG,SAAS,CAElB;AAED,eAAO,MAAM,sBAAsB,kBAGlC,CAAA;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,WAInD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,cAAc,GAsB5D,cAAc,CACpB"}
@@ -1,5 +1,5 @@
1
1
  export { ControllerNames, ControllerTypes } from '../pages/controller-types.js';
2
2
  export { PageTypes } from '../pages/page-types.js';
3
- export { controllerNameFromPath, getPageDefaults, getPageFromDefinition, getPageTitle, hasComponents, hasComponentsEvenIfNoNext, hasFormComponents, hasNext, hasRepeater, includesFileUploadField, isControllerName, isSummaryPage, showRepeaterSettings, summaryPageControllers } from '../pages/helpers.js';
3
+ export { controllerNameFromPath, getPageDefaults, getPageFromDefinition, getPageTitle, hasComponents, hasComponentsEvenIfNoNext, hasFormComponents, hasNext, hasRepeater, includesFileUploadField, isControllerName, isSummaryPage, replaceCustomControllers, showRepeaterSettings, summaryPageControllers } from '../pages/helpers.js';
4
4
  export { ControllerPath, ControllerType } from '../pages/enums.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,EAChB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,EAChB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.593",
3
+ "version": "3.0.594",
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
  "types": "dist/types/index.d.ts",
@@ -51,6 +51,6 @@
51
51
  },
52
52
  "engines": {
53
53
  "node": "^22.11.0",
54
- "npm": "^10.9.0"
54
+ "npm": ">=10.9.0 <11.6.4"
55
55
  }
56
56
  }
@@ -188,3 +188,33 @@ export function isSummaryPage(page: Page | undefined) {
188
188
  page?.controller ?? ControllerType.Page
189
189
  )
190
190
  }
191
+
192
+ /**
193
+ * Revert any custom controllers to their parent/base class since engine-plugin has no knowledge of them
194
+ * @param {FormDefinition} definition
195
+ * @returns {FormDefinition}
196
+ */
197
+ export function replaceCustomControllers(definition: FormDefinition) {
198
+ const standardControllers = new Set(
199
+ Object.values(ControllerType)
200
+ .filter((x) => x !== ControllerType.SummaryWithConfirmationEmail)
201
+ .map((x) => x.toString())
202
+ )
203
+
204
+ return {
205
+ ...definition,
206
+ pages: definition.pages.map((page) => {
207
+ if (
208
+ !standardControllers.has(
209
+ (page.controller ?? ControllerType.Page).toString()
210
+ )
211
+ ) {
212
+ return /** @type {Page} */ {
213
+ ...page,
214
+ controller: ControllerType.Page
215
+ }
216
+ }
217
+ return page
218
+ })
219
+ } as FormDefinition
220
+ }
@@ -18,6 +18,7 @@ export {
18
18
  includesFileUploadField,
19
19
  isControllerName,
20
20
  isSummaryPage,
21
+ replaceCustomControllers,
21
22
  showRepeaterSettings,
22
23
  summaryPageControllers
23
24
  } from '~/src/pages/helpers.js'