Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module.exports = {
transformIgnorePatterns: [
`node_modules/(?!${[
'@defra/forms-model/.*',
'@joi/date', // Supports ESM only
'nanoid', // Supports ESM only
'slug', // Supports ESM only
'@defra/hapi-tracing', // Supports ESM only
Expand Down
380 changes: 341 additions & 39 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
},
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@defra/forms-model": "^3.0.708",
"@defra/forms-model": "^4.0.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not 4.0.1 now?

"@defra/hapi-tracing": "^1.29.0",
"@defra/interactive-map": "0.0.33-alpha",
"@elastic/ecs-pino-format": "^1.5.0",
Expand Down Expand Up @@ -134,7 +134,7 @@
"humanize-duration": "^3.33.1",
"i18next": "^26.0.5",
"ioredis": "^5.8.2",
"joi": "^17.13.3",
"joi": "^18.2.9",
"liquidjs": "^10.24.0",
"lodash": "^4.17.21",
"lru-cache": "^11.5.1",
Expand Down
6 changes: 3 additions & 3 deletions src/server/plugins/engine/components/CheckboxesField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
export class CheckboxesField extends SelectionControlField {
declare options: CheckboxesFieldComponent['options']
declare schema: CheckboxesFieldComponent['schema']
declare formSchema: ArraySchema<string> | ArraySchema<number>
declare stateSchema: ArraySchema<string> | ArraySchema<number>
declare formSchema: ArraySchema<string[]> | ArraySchema<number[]>
declare stateSchema: ArraySchema<string[]> | ArraySchema<number[]>
declare limits: { min?: number; max?: number; length?: number }

constructor(
Expand All @@ -33,7 +33,7 @@ export class CheckboxesField extends SelectionControlField {
const { options, schema } = def

let formSchema =
type === 'string' ? joi.array<string>() : joi.array<number>()
type === 'string' ? joi.array<string[]>() : joi.array<number[]>()

const itemsSchema = joi[type]()
.valid(...this.values)
Expand Down
8 changes: 4 additions & 4 deletions src/server/plugins/engine/components/ComponentBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export class ComponentBase {
}

export type ComponentSchema =
| ArraySchema<string>
| ArraySchema<number>
| ArraySchema<boolean>
| ArraySchema<object>
| ArraySchema<string[]>
| ArraySchema<number[]>
| ArraySchema<boolean[]>
| ArraySchema<object[]>
| BooleanSchema<string>
| BooleanSchema
| DateSchema
Expand Down
7 changes: 3 additions & 4 deletions src/server/plugins/engine/components/DeclarationField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
import joi, {
type ArraySchema,
type BooleanSchema,
type LanguageMessages,
type StringSchema
type LanguageMessages
} from 'joi'

import {
Expand All @@ -34,7 +33,7 @@ export class DeclarationField extends FormComponent {

declare declarationConfirmationLabel: string | undefined

declare formSchema: ArraySchema<StringSchema[]>
declare formSchema: ArraySchema<string[]>
declare stateSchema: BooleanSchema
declare content: string
headerStartLevel: number
Expand Down Expand Up @@ -63,7 +62,7 @@ export class DeclarationField extends FormComponent {
'any.unknown': messageTemplate.declarationRequired as string,
'array.includesRequiredUnknowns':
messageTemplate.declarationRequired as string
}) as ArraySchema<StringSchema[]>
})

this.formSchema = formSchema
this.stateSchema = joi.boolean().cast('string').label(this.label).required()
Expand Down
4 changes: 2 additions & 2 deletions src/server/plugins/engine/components/FileUploadField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ export const formItemSchema = itemSchema.append({
export class FileUploadField extends FormComponent {
declare options: FileUploadFieldComponent['options']
declare schema: FileUploadFieldComponent['schema']
declare formSchema: ArraySchema<FileState>
declare stateSchema: ArraySchema<FileState>
declare formSchema: ArraySchema<FileState[]>
declare stateSchema: ArraySchema<FileState[]>
declare limits: { min?: number; max?: number; length?: number }

constructor(
Expand Down
8 changes: 4 additions & 4 deletions src/server/plugins/engine/components/ListFormComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ export class ListFormComponent extends FormComponent {
>['options']

declare formSchema:
| ArraySchema<string>
| ArraySchema<number>
| ArraySchema<string[]>
| ArraySchema<number[]>
| BooleanSchema<string>
| NumberSchema<string>
| NumberSchema
| StringSchema

declare stateSchema:
| ArraySchema<string>
| ArraySchema<number>
| ArraySchema<string[]>
| ArraySchema<number[]>
| BooleanSchema<string>
| NumberSchema<string>
| NumberSchema
Expand Down
Loading