@defra/forms-model 3.0.172 → 3.0.174
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
CHANGED
package/src/data-model/index.ts
CHANGED
@@ -9,20 +9,15 @@ import {
|
|
9
9
|
type ConditionRawData,
|
10
10
|
type ConditionWrapperValue,
|
11
11
|
type ConfirmationPage,
|
12
|
-
type EmailOutputConfiguration,
|
13
12
|
type FormDefinition,
|
14
13
|
type Item,
|
15
14
|
type List,
|
16
|
-
type MultipleApiKeys,
|
17
15
|
type Next,
|
18
|
-
type NotifyOutputConfiguration,
|
19
|
-
type Output,
|
20
16
|
type Page,
|
21
17
|
type PhaseBanner,
|
22
18
|
type RepeatingFieldPage,
|
23
19
|
type Section,
|
24
|
-
type SpecialPages
|
25
|
-
type WebhookOutputConfiguration
|
20
|
+
type SpecialPages
|
26
21
|
} from '~/src/form/form-definition/types.js'
|
27
22
|
|
28
23
|
/**
|
@@ -181,48 +176,6 @@ const listSchema = Joi.object<List>().keys({
|
|
181
176
|
items: Joi.array<Item>().items(listItemSchema)
|
182
177
|
})
|
183
178
|
|
184
|
-
const multiApiKeySchema = Joi.object<MultipleApiKeys>({
|
185
|
-
test: Joi.string().optional(),
|
186
|
-
production: Joi.string().optional()
|
187
|
-
})
|
188
|
-
|
189
|
-
const replyToConfigurationSchema = Joi.object({
|
190
|
-
emailReplyToId: Joi.string(),
|
191
|
-
condition: Joi.string().allow('').optional()
|
192
|
-
})
|
193
|
-
|
194
|
-
const notifySchema = Joi.object<NotifyOutputConfiguration>().keys({
|
195
|
-
apiKey: [Joi.string().allow('').optional(), multiApiKeySchema],
|
196
|
-
templateId: Joi.string(),
|
197
|
-
emailField: Joi.string(),
|
198
|
-
personalisation: Joi.array<string>().items(Joi.string()),
|
199
|
-
personalisationFieldCustomisation: Joi.object()
|
200
|
-
.pattern(/./, Joi.array<string>().items(Joi.string()))
|
201
|
-
.optional(),
|
202
|
-
addReferencesToPersonalisation: Joi.boolean().optional(),
|
203
|
-
emailReplyToIdConfiguration: Joi.array().items(replyToConfigurationSchema)
|
204
|
-
})
|
205
|
-
|
206
|
-
const emailSchema = Joi.object<EmailOutputConfiguration>().keys({
|
207
|
-
emailAddress: Joi.string().required()
|
208
|
-
})
|
209
|
-
|
210
|
-
const webhookSchema = Joi.object<WebhookOutputConfiguration>().keys({
|
211
|
-
url: Joi.string(),
|
212
|
-
allowRetry: Joi.boolean().optional().default(true)
|
213
|
-
})
|
214
|
-
|
215
|
-
const outputSchema = Joi.object<Output>().keys({
|
216
|
-
name: Joi.string(),
|
217
|
-
title: Joi.string().optional(),
|
218
|
-
type: Joi.string().allow('notify', 'email', 'webhook', 'sheets'),
|
219
|
-
outputConfiguration: Joi.alternatives().try(
|
220
|
-
notifySchema,
|
221
|
-
emailSchema,
|
222
|
-
webhookSchema
|
223
|
-
)
|
224
|
-
})
|
225
|
-
|
226
179
|
const feedbackSchema = Joi.object<FormDefinition['feedback']>().keys({
|
227
180
|
feedbackForm: Joi.boolean().default(false),
|
228
181
|
url: Joi.when('feedbackForm', {
|
@@ -266,7 +219,6 @@ export const formDefinitionSchema = Joi.object<FormDefinition>()
|
|
266
219
|
lists: Joi.array<List>().items(listSchema).unique('name'),
|
267
220
|
metadata: Joi.object({ a: Joi.any() }).unknown().optional(),
|
268
221
|
declaration: Joi.string().allow('').optional(),
|
269
|
-
outputs: Joi.array<Output>().items(outputSchema),
|
270
222
|
skipSummary: Joi.boolean().optional().default(false),
|
271
223
|
phaseBanner: phaseBannerSchema,
|
272
224
|
specialPages: specialPagesSchema.optional(),
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { type ComponentDef } from '~/src/components/types.js'
|
2
2
|
import { type Condition } from '~/src/conditions/condition.js'
|
3
|
-
import { type OutputType } from '~/src/data-model/enums.js'
|
4
3
|
import { formDefinitionSchema } from '~/src/form/form-definition/index.js'
|
5
4
|
|
6
5
|
type Toggleable<T> = boolean | T
|
@@ -70,45 +69,6 @@ export interface PhaseBanner {
|
|
70
69
|
feedbackUrl?: string
|
71
70
|
}
|
72
71
|
|
73
|
-
export interface MultipleApiKeys {
|
74
|
-
test?: string
|
75
|
-
production?: string
|
76
|
-
}
|
77
|
-
|
78
|
-
export interface EmailOutputConfiguration {
|
79
|
-
emailAddress: string
|
80
|
-
}
|
81
|
-
|
82
|
-
export interface NotifyOutputConfiguration {
|
83
|
-
apiKey: string
|
84
|
-
templateId: string
|
85
|
-
emailField: string
|
86
|
-
personalisation: string[]
|
87
|
-
personalisationFieldCustomisation?: Record<string, string[]>
|
88
|
-
addReferencesToPersonalisation?: boolean
|
89
|
-
emailReplyToIdConfiguration?: {
|
90
|
-
emailReplyToId: string
|
91
|
-
condition?: string
|
92
|
-
}[]
|
93
|
-
}
|
94
|
-
|
95
|
-
export interface WebhookOutputConfiguration {
|
96
|
-
url: string
|
97
|
-
allowRetry?: boolean
|
98
|
-
}
|
99
|
-
|
100
|
-
export type OutputConfiguration =
|
101
|
-
| EmailOutputConfiguration
|
102
|
-
| NotifyOutputConfiguration
|
103
|
-
| WebhookOutputConfiguration
|
104
|
-
|
105
|
-
export interface Output {
|
106
|
-
name: string
|
107
|
-
title: string
|
108
|
-
type: OutputType
|
109
|
-
outputConfiguration: OutputConfiguration
|
110
|
-
}
|
111
|
-
|
112
72
|
export interface ConfirmationPage {
|
113
73
|
customText: {
|
114
74
|
title: string
|
@@ -148,7 +108,6 @@ export interface FormDefinition {
|
|
148
108
|
feedback?: Feedback
|
149
109
|
phaseBanner?: PhaseBanner
|
150
110
|
skipSummary?: boolean
|
151
|
-
outputs: Output[]
|
152
111
|
declaration?: string
|
153
112
|
metadata?: Record<string, unknown>
|
154
113
|
specialPages?: SpecialPages
|