@defra/forms-model 3.0.642 → 3.0.644

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.
Files changed (38) hide show
  1. package/dist/module/form/form-audit/index.js +5 -4
  2. package/dist/module/form/form-audit/index.js.map +1 -1
  3. package/dist/module/form/form-definition/constants.js +3 -0
  4. package/dist/module/form/form-definition/constants.js.map +1 -0
  5. package/dist/module/form/form-definition/index.js +6 -9
  6. package/dist/module/form/form-definition/index.js.map +1 -1
  7. package/dist/module/form/form-editor/index.js +4 -1
  8. package/dist/module/form/form-editor/index.js.map +1 -1
  9. package/dist/module/form/form-metadata/index.js +4 -3
  10. package/dist/module/form/form-metadata/index.js.map +1 -1
  11. package/dist/module/form/utils/index.js +1 -0
  12. package/dist/module/form/utils/index.js.map +1 -1
  13. package/dist/module/form/utils/prevent-unicode.js +20 -0
  14. package/dist/module/form/utils/prevent-unicode.js.map +1 -0
  15. package/dist/module/manage/roles.js +1 -0
  16. package/dist/module/manage/roles.js.map +1 -1
  17. package/dist/types/form/form-definition/constants.d.ts +3 -0
  18. package/dist/types/form/form-definition/constants.d.ts.map +1 -0
  19. package/dist/types/form/form-definition/index.d.ts +1 -2
  20. package/dist/types/form/form-definition/index.d.ts.map +1 -1
  21. package/dist/types/form/form-editor/index.d.ts +2 -0
  22. package/dist/types/form/form-editor/index.d.ts.map +1 -1
  23. package/dist/types/form/form-metadata/index.d.ts.map +1 -1
  24. package/dist/types/form/utils/index.d.ts +1 -0
  25. package/dist/types/form/utils/index.d.ts.map +1 -1
  26. package/dist/types/form/utils/prevent-unicode.d.ts +10 -0
  27. package/dist/types/form/utils/prevent-unicode.d.ts.map +1 -0
  28. package/dist/types/manage/roles.d.ts +2 -1
  29. package/dist/types/manage/roles.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/src/form/form-audit/index.ts +4 -4
  32. package/src/form/form-definition/constants.ts +2 -0
  33. package/src/form/form-definition/index.ts +13 -14
  34. package/src/form/form-editor/index.ts +11 -1
  35. package/src/form/form-metadata/index.ts +7 -8
  36. package/src/form/utils/index.ts +1 -0
  37. package/src/form/utils/prevent-unicode.js +19 -0
  38. package/src/manage/roles.ts +2 -1
@@ -1,6 +1,7 @@
1
1
  import Joi from 'joi';
2
2
  import { AuditEventMessageCategory, AuditEventMessageSchemaVersion, AuditEventMessageSource, AuditEventMessageType, FormDefinitionRequestType } from "./enums.js";
3
- import { contactSchema, emailAddressSchema, emailResponseTimeSchema, idSchema, notificationEmailAddressSchema, onlineTextSchema, onlineUrlSchema, organisationSchema, phoneSchema, privacyNoticeTextSchema, privacyNoticeTypeSchema, privacyNoticeUrlSchema, slugSchema, submissionGuidanceSchema, teamEmailSchema, teamNameSchema, termsAndConditionsAgreedSchema, titleSchema } from "../form-metadata/index.js";
3
+ import { emailAddressNoUnicodeSchema } from "../form-editor/index.js";
4
+ import { contactSchema, emailResponseTimeSchema, idSchema, notificationEmailAddressSchema, onlineTextSchema, onlineUrlSchema, organisationSchema, phoneSchema, privacyNoticeTextSchema, privacyNoticeTypeSchema, privacyNoticeUrlSchema, slugSchema, submissionGuidanceSchema, teamEmailSchema, teamNameSchema, termsAndConditionsAgreedSchema, titleSchema } from "../form-metadata/index.js";
4
5
  export const formMessageDataBase = Joi.object({
5
6
  formId: idSchema,
6
7
  slug: slugSchema,
@@ -58,7 +59,7 @@ export const formSupportOnlineChanges = Joi.object().keys({
58
59
  text: onlineTextSchema.optional()
59
60
  }).required().description('Changes schema for FORM_SUPPORT_ONLINE_UPDATED event');
60
61
  export const formSupportEmailChanges = Joi.object().keys({
61
- address: emailAddressSchema.optional(),
62
+ address: emailAddressNoUnicodeSchema.optional(),
62
63
  responseTime: emailResponseTimeSchema.optional()
63
64
  }).description('Changes schema for FORM_SUPPORT_EMAIL_UPDATED event');
64
65
  export const formPrivacyNoticeChanges = Joi.object().keys({
@@ -89,7 +90,7 @@ export const formUploadedChanges = Joi.object().keys({
89
90
  export const entitlementMessageData = Joi.object().keys({
90
91
  userId: Joi.string().required(),
91
92
  displayName: Joi.string().required(),
92
- email: Joi.string().email().required(),
93
+ email: emailAddressNoUnicodeSchema.required(),
93
94
  roles: Joi.array().items(Joi.string())
94
95
  });
95
96
  export const formFileDownloadedMessageData = Joi.object().keys({
@@ -100,7 +101,7 @@ export const formFileDownloadedMessageData = Joi.object().keys({
100
101
  export const excelGenerationMessageData = Joi.object().keys({
101
102
  formId: Joi.string().required(),
102
103
  formName: Joi.string().required(),
103
- notificationEmail: Joi.string().email().required()
104
+ notificationEmail: emailAddressNoUnicodeSchema.required()
104
105
  }).required().description('Schema for Excel generation audit events (submissions and CSAT)');
105
106
  export const authenticationMessageData = Joi.object().keys({
106
107
  userId: Joi.string().required(),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Joi","AuditEventMessageCategory","AuditEventMessageSchemaVersion","AuditEventMessageSource","AuditEventMessageType","FormDefinitionRequestType","contactSchema","emailAddressSchema","emailResponseTimeSchema","idSchema","notificationEmailAddressSchema","onlineTextSchema","onlineUrlSchema","organisationSchema","phoneSchema","privacyNoticeTextSchema","privacyNoticeTypeSchema","privacyNoticeUrlSchema","slugSchema","submissionGuidanceSchema","teamEmailSchema","teamNameSchema","termsAndConditionsAgreedSchema","titleSchema","formMessageDataBase","object","formId","slug","payload","optional","required","description","formCreatedMessageData","append","title","organisation","teamName","teamEmail","formDefinitionS3Meta","keys","fileId","string","filename","s3Key","formUpdatedMessageData","requestType","valid","Object","values","s3Meta","formsBackupRequestedMessageData","totalForms","number","integer","min","durationMs","formsSecretDeletedMessageData","secretName","formsSecretSavedMessageData","dlqActionMessageData","action","messageId","formTitleChanges","formOrganisationChanges","formTeamNameChanges","formTeamEmailChanges","formSupportContactChanges","contact","formSupportPhoneChanges","phone","formSupportOnlineChanges","url","text","formSupportEmailChanges","address","responseTime","formPrivacyNoticeChanges","privacyNoticeType","privacyNoticeText","when","is","then","otherwise","allow","privacyNoticeUrl","formTermsAndConditionsChanges","termsAndConditionsAgreed","formNotificationEmailChanges","notificationEmail","formSubmissionGuidanceChanges","submissionGuidance","formUploadedChanges","value","entitlementMessageData","userId","displayName","email","roles","array","items","formFileDownloadedMessageData","fileLink","excelGenerationMessageData","formName","authenticationMessageData","auditUserSchema","id","formChangesMessageData","schema","changes","previous","new","messageSchema","schemaVersion","category","source","type","entityId","traceId","createdAt","date","createdBy","data","switch","trim","FORM_CREATED","FORM_TITLE_UPDATED","FORM_ORGANISATION_UPDATED","FORM_TEAM_NAME_UPDATED","FORM_TEAM_EMAIL_UPDATED","FORM_SUPPORT_CONTACT_UPDATED","FORM_SUPPORT_PHONE_UPDATED","FORM_SUPPORT_EMAIL_UPDATED","FORM_SUPPORT_ONLINE_UPDATED","FORM_PRIVACY_NOTICE_UPDATED","FORM_TERMS_AND_CONDITIONS_AGREED","FORM_NOTIFICATION_EMAIL_UPDATED","FORM_SUBMISSION_GUIDANCE_UPDATED","FORM_JSON_UPLOADED","FORM_UPDATED","ENTITLEMENT_CREATED","ENTITLEMENT_UPDATED","ENTITLEMENT_DELETED","FORM_DRAFT_DELETED","FORM_JSON_DOWNLOADED","AUTHENTICATION_LOGIN","AUTHENTICATION_LOGOUT_MANUAL","AUTHENTICATION_LOGOUT_AUTO","AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE","FORM_FILE_DOWNLOAD_SUCCESS","FORM_FILE_DOWNLOAD_FAILURE","FORM_SUBMISSION_EXCEL_REQUESTED","FORM_CSAT_EXCEL_REQUESTED","PLATFORM_CSAT_EXCEL_REQUESTED","FORMS_BACKUP_REQUESTED","FORM_SECRET_DELETED","FORM_SECRET_SAVED","DLQ_ACTION","forbidden","messageCreatedAt","auditEvent","message","auditRecord","uuid","recordCreatedAt"],"sources":["../../../../src/form/form-audit/index.ts"],"sourcesContent":["import Joi, { type ObjectSchema } from 'joi'\n\nimport {\n AuditEventMessageCategory,\n AuditEventMessageSchemaVersion,\n AuditEventMessageSource,\n AuditEventMessageType,\n FormDefinitionRequestType\n} from '~/src/form/form-audit/enums.js'\nimport {\n type AuditEvent,\n type AuditMessage,\n type AuditRecord,\n type AuditUser,\n type AuthenticationMessageData,\n type ChangesMessageData,\n type DlqActionMessageData,\n type EntitlementMessageData,\n type ExcelGenerationMessageData,\n type FormCreatedMessageData,\n type FormDefinitionS3Meta,\n type FormFileDownloadedMessageData,\n type FormMessageChangesData,\n type FormMessageDataBase,\n type FormNotificationEmailChanges,\n type FormNotificationEmailUpdatedMessageData,\n type FormOrganisationChanges,\n type FormOrganisationUpdatedMessageData,\n type FormPrivacyNoticeChanges,\n type FormPrivacyNoticeUpdatedMessageData,\n type FormSecretBaseMessageData,\n type FormSubmissionGuidanceChanges,\n type FormSubmissionGuidanceUpdatedMessageData,\n type FormSupportContactChanges,\n type FormSupportContactUpdatedMessageData,\n type FormSupportEmailChanges,\n type FormSupportEmailUpdatedMessageData,\n type FormSupportOnlineChanges,\n type FormSupportOnlineUpdatedMessageData,\n type FormSupportPhoneChanges,\n type FormSupportPhoneUpdatedMessageData,\n type FormTeamEmailChanges,\n type FormTeamEmailUpdatedMessageData,\n type FormTeamNameChanges,\n type FormTeamNameUpdatedMessageData,\n type FormTermsAndConditionsAgreedMessageData,\n type FormTermsAndConditionsChanges,\n type FormTitleChanges,\n type FormTitleUpdatedMessageData,\n type FormUpdatedMessageData,\n type FormUploadedChanges,\n type FormUploadedMessageData,\n type FormsBackupRequestedMessageData\n} from '~/src/form/form-audit/types.js'\nimport {\n contactSchema,\n emailAddressSchema,\n emailResponseTimeSchema,\n idSchema,\n notificationEmailAddressSchema,\n onlineTextSchema,\n onlineUrlSchema,\n organisationSchema,\n phoneSchema,\n privacyNoticeTextSchema,\n privacyNoticeTypeSchema,\n privacyNoticeUrlSchema,\n slugSchema,\n submissionGuidanceSchema,\n teamEmailSchema,\n teamNameSchema,\n termsAndConditionsAgreedSchema,\n titleSchema\n} from '~/src/form/form-metadata/index.js'\n\nexport const formMessageDataBase = Joi.object<FormMessageDataBase>({\n formId: idSchema,\n slug: slugSchema,\n payload: Joi.object().optional()\n})\n .required()\n .description('The base data object for Form Messages')\n\nexport const formCreatedMessageData = formMessageDataBase\n .append<FormCreatedMessageData>({\n title: titleSchema,\n organisation: organisationSchema,\n teamName: teamNameSchema,\n teamEmail: teamEmailSchema\n })\n .required()\n .description('Message data schema for when a form is created')\n\nexport const formDefinitionS3Meta = Joi.object<FormDefinitionS3Meta>()\n .keys({\n fileId: Joi.string().required(),\n filename: Joi.string().required(),\n s3Key: Joi.string().required()\n })\n .description('Schema for form data S3 object in message')\n\nexport const formUpdatedMessageData = formMessageDataBase\n .append<FormUpdatedMessageData>({\n requestType: Joi.string()\n .valid(...Object.values(FormDefinitionRequestType))\n .required(),\n s3Meta: formDefinitionS3Meta.optional()\n })\n .required()\n\nexport const formsBackupRequestedMessageData =\n Joi.object<FormsBackupRequestedMessageData>().keys({\n totalForms: Joi.number().integer().min(0).required(),\n durationMs: Joi.number().min(0).required()\n })\n\nexport const formsSecretDeletedMessageData =\n formMessageDataBase.append<FormSecretBaseMessageData>({\n secretName: Joi.string().required()\n })\n\nexport const formsSecretSavedMessageData =\n formMessageDataBase.append<FormSecretBaseMessageData>({\n secretName: Joi.string().required()\n })\n\nexport const dlqActionMessageData = Joi.object<DlqActionMessageData>().keys({\n action: Joi.string().valid('redrive', 'delete').required(),\n messageId: Joi.string().optional()\n})\n\nexport const formTitleChanges = Joi.object<FormTitleChanges>()\n .keys({\n title: titleSchema\n })\n .required()\n .description('Changes schema for FORM_TITLE_UPDATED event')\n\nexport const formOrganisationChanges = Joi.object<FormOrganisationChanges>()\n .keys({\n organisation: organisationSchema\n })\n .required()\n .description('Changes schema for FORM_ORGANISATION_UPDATED event')\n\nexport const formTeamNameChanges = Joi.object<FormTeamNameChanges>()\n .keys({\n teamName: teamNameSchema\n })\n .required()\n .description('Changes schema for FORM_TEAM_NAME_UPDATED event')\n\nexport const formTeamEmailChanges = Joi.object<FormTeamEmailChanges>()\n .keys({\n teamEmail: teamEmailSchema\n })\n .required()\n .description('Changes schema for FORM_TEAM_EMAIL_UPDATED event')\n\nexport const formSupportContactChanges = Joi.object<FormSupportContactChanges>()\n .keys({\n contact: contactSchema\n })\n .required()\n .description('Changes schema for FORM_SUPPORT_CONTACT_UPDATED event')\n\nexport const formSupportPhoneChanges = Joi.object<FormSupportPhoneChanges>()\n .keys({\n phone: phoneSchema\n })\n .required()\n .description('Changes schema for FORM_SUPPORT_PHONE_UPDATED event')\n\nexport const formSupportOnlineChanges = Joi.object<FormSupportOnlineChanges>()\n .keys({\n url: onlineUrlSchema.optional(),\n text: onlineTextSchema.optional()\n })\n .required()\n .description('Changes schema for FORM_SUPPORT_ONLINE_UPDATED event')\n\nexport const formSupportEmailChanges = Joi.object<FormSupportEmailChanges>()\n .keys({\n address: emailAddressSchema.optional(),\n responseTime: emailResponseTimeSchema.optional()\n })\n .description('Changes schema for FORM_SUPPORT_EMAIL_UPDATED event')\n\nexport const formPrivacyNoticeChanges = Joi.object<FormPrivacyNoticeChanges>()\n .keys({\n privacyNoticeType: privacyNoticeTypeSchema,\n privacyNoticeText: Joi.when('privacyNoticeType', {\n is: 'text',\n then: privacyNoticeTextSchema,\n otherwise: privacyNoticeTextSchema.allow('')\n }),\n privacyNoticeUrl: Joi.when('privacyNoticeType', {\n is: 'link',\n then: privacyNoticeUrlSchema,\n otherwise: privacyNoticeUrlSchema.allow('')\n })\n })\n .required()\n .description('Changes schema for FORM_PRIVACY_NOTICE_UPDATED event')\n\nexport const formTermsAndConditionsChanges =\n Joi.object<FormTermsAndConditionsChanges>()\n .keys({\n termsAndConditionsAgreed: termsAndConditionsAgreedSchema\n })\n .required()\n .description('Changes schema for FORM_TERMS_AND_CONDITIONS_AGREED event')\n\nexport const formNotificationEmailChanges =\n Joi.object<FormNotificationEmailChanges>()\n .keys({\n notificationEmail: notificationEmailAddressSchema\n })\n .required()\n .description('Changes schema for FORM_NOTIFICATION_EMAIL_UPDATED event')\n\nexport const formSubmissionGuidanceChanges =\n Joi.object<FormSubmissionGuidanceChanges>()\n .keys({\n submissionGuidance: submissionGuidanceSchema\n })\n .required()\n .description('Changes schema for FORM_SUBMISSION_GUIDANCE_UPDATED event')\n\nexport const formUploadedChanges = Joi.object<FormUploadedChanges>()\n .keys({\n value: Joi.string().required()\n })\n .required()\n .description('Changes schema for FORM_JSON_UPLOADED event')\n\nexport const entitlementMessageData = Joi.object<EntitlementMessageData>().keys(\n {\n userId: Joi.string().required(),\n displayName: Joi.string().required(),\n email: Joi.string().email().required(),\n roles: Joi.array().items(Joi.string())\n }\n)\n\nexport const formFileDownloadedMessageData =\n Joi.object<FormFileDownloadedMessageData>()\n .keys({\n fileId: Joi.string().required(),\n filename: Joi.string().required(),\n fileLink: Joi.string().required()\n })\n .required()\n .description(\n 'Schema for FORM_FILE_DOWNLOAD_SUCCESS and FORM_FILE_DOWNLOAD_FAILURE events'\n )\n\nexport const excelGenerationMessageData =\n Joi.object<ExcelGenerationMessageData>()\n .keys({\n formId: Joi.string().required(),\n formName: Joi.string().required(),\n notificationEmail: Joi.string().email().required()\n })\n .required()\n .description(\n 'Schema for Excel generation audit events (submissions and CSAT)'\n )\n\nexport const authenticationMessageData =\n Joi.object<AuthenticationMessageData>().keys({\n userId: Joi.string().required(),\n displayName: Joi.string().required()\n })\n\nexport const auditUserSchema = Joi.object<AuditUser>()\n .keys({\n id: Joi.string().required(),\n displayName: Joi.string().required()\n })\n .description('Schema for CREATED_BY audit event')\n\nexport function formChangesMessageData<T, U extends FormMessageChangesData>(\n schema: ObjectSchema<T>\n): ObjectSchema<U> {\n return formMessageDataBase.append<U>({\n changes: Joi.object<ChangesMessageData<T>>()\n .keys({\n previous: schema,\n new: schema\n })\n .description('Changes schema')\n })\n}\n\nexport const messageSchema = Joi.object<AuditMessage>()\n .keys({\n schemaVersion: Joi.string()\n .valid(...Object.values(AuditEventMessageSchemaVersion))\n .required()\n .description(\n 'The version of the AuditMessage - bumped with breaking changes'\n ),\n category: Joi.string()\n .valid(...Object.values(AuditEventMessageCategory))\n .required()\n .description('The message category - what does the entityId represent?'),\n source: Joi.string()\n .valid(...Object.values(AuditEventMessageSource))\n .required()\n .description('Source of the message - which service?'),\n type: Joi.string()\n .valid(...Object.values(AuditEventMessageType))\n .description('Event type'),\n entityId: Joi.string()\n .required()\n .description('The id of the entity the category relates to'),\n traceId: Joi.string()\n .optional()\n .description(\n 'Trace id of the event - to link events across multiple services'\n ),\n createdAt: Joi.date()\n .required()\n .description(\n 'The ISO timestamp where the action took place - should be the same as updated_at field in DB'\n ),\n createdBy: auditUserSchema\n .required()\n .description('The user who performed the action being audited'),\n data: Joi.when('type', {\n switch: [\n {\n is: Joi.string().trim().valid(AuditEventMessageType.FORM_CREATED),\n then: formCreatedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_TITLE_UPDATED),\n then: formChangesMessageData<\n FormTitleChanges,\n FormTitleUpdatedMessageData\n >(formTitleChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_ORGANISATION_UPDATED),\n then: formChangesMessageData<\n FormOrganisationChanges,\n FormOrganisationUpdatedMessageData\n >(formOrganisationChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_TEAM_NAME_UPDATED),\n then: formChangesMessageData<\n FormTeamNameChanges,\n FormTeamNameUpdatedMessageData\n >(formTeamNameChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_TEAM_EMAIL_UPDATED),\n then: formChangesMessageData<\n FormTeamEmailChanges,\n FormTeamEmailUpdatedMessageData\n >(formTeamEmailChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUPPORT_CONTACT_UPDATED),\n then: formChangesMessageData<\n FormSupportContactChanges,\n FormSupportContactUpdatedMessageData\n >(formSupportContactChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUPPORT_PHONE_UPDATED),\n then: formChangesMessageData<\n FormSupportPhoneChanges,\n FormSupportPhoneUpdatedMessageData\n >(formSupportPhoneChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUPPORT_EMAIL_UPDATED),\n then: formChangesMessageData<\n FormSupportEmailChanges,\n FormSupportEmailUpdatedMessageData\n >(formSupportEmailChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUPPORT_ONLINE_UPDATED),\n then: formChangesMessageData<\n FormSupportOnlineChanges,\n FormSupportOnlineUpdatedMessageData\n >(formSupportOnlineChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_PRIVACY_NOTICE_UPDATED),\n then: formChangesMessageData<\n FormPrivacyNoticeChanges,\n FormPrivacyNoticeUpdatedMessageData\n >(formPrivacyNoticeChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_TERMS_AND_CONDITIONS_AGREED),\n then: formChangesMessageData<\n FormTermsAndConditionsChanges,\n FormTermsAndConditionsAgreedMessageData\n >(formTermsAndConditionsChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_NOTIFICATION_EMAIL_UPDATED),\n then: formChangesMessageData<\n FormNotificationEmailChanges,\n FormNotificationEmailUpdatedMessageData\n >(formNotificationEmailChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUBMISSION_GUIDANCE_UPDATED),\n then: formChangesMessageData<\n FormSubmissionGuidanceChanges,\n FormSubmissionGuidanceUpdatedMessageData\n >(formSubmissionGuidanceChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_JSON_UPLOADED),\n then: formChangesMessageData<\n FormUploadedChanges,\n FormUploadedMessageData\n >(formUploadedChanges)\n },\n {\n is: Joi.string().trim().valid(AuditEventMessageType.FORM_UPDATED),\n then: formUpdatedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(\n AuditEventMessageType.ENTITLEMENT_CREATED,\n AuditEventMessageType.ENTITLEMENT_UPDATED,\n AuditEventMessageType.ENTITLEMENT_DELETED\n ),\n then: entitlementMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_DRAFT_DELETED),\n then: formMessageDataBase\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_JSON_DOWNLOADED),\n then: formMessageDataBase\n },\n {\n is: Joi.string()\n .trim()\n .valid(\n AuditEventMessageType.AUTHENTICATION_LOGIN,\n AuditEventMessageType.AUTHENTICATION_LOGOUT_MANUAL,\n AuditEventMessageType.AUTHENTICATION_LOGOUT_AUTO,\n AuditEventMessageType.AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE\n ),\n then: authenticationMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(\n AuditEventMessageType.FORM_FILE_DOWNLOAD_SUCCESS,\n AuditEventMessageType.FORM_FILE_DOWNLOAD_FAILURE\n ),\n then: formFileDownloadedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(\n AuditEventMessageType.FORM_SUBMISSION_EXCEL_REQUESTED,\n AuditEventMessageType.FORM_CSAT_EXCEL_REQUESTED,\n AuditEventMessageType.PLATFORM_CSAT_EXCEL_REQUESTED\n ),\n then: excelGenerationMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORMS_BACKUP_REQUESTED),\n then: formsBackupRequestedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SECRET_DELETED),\n then: formsSecretDeletedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SECRET_SAVED),\n then: formsSecretSavedMessageData\n },\n {\n is: Joi.string().trim().valid(AuditEventMessageType.DLQ_ACTION),\n then: dlqActionMessageData\n }\n ],\n otherwise: Joi.forbidden()\n }).description('The data/payload of the audit message'),\n messageCreatedAt: Joi.date()\n .required()\n .description('ISO timestamp when the message was published')\n })\n .required()\n .description('The audit message issued by the publishing service')\n\nexport const auditEvent = Joi.object<AuditEvent>()\n .keys({\n message: messageSchema\n })\n .description('The Body of the audit event')\n\nexport const auditRecord = messageSchema\n .append<AuditRecord>({\n id: idSchema,\n messageId: Joi.string().uuid().required(),\n entityId: Joi.string().required(),\n recordCreatedAt: Joi.date().required()\n })\n .description('The audit record persisted into the DB')\n"],"mappings":"AAAA,OAAOA,GAAG,MAA6B,KAAK;AAE5C,SACEC,yBAAyB,EACzBC,8BAA8B,EAC9BC,uBAAuB,EACvBC,qBAAqB,EACrBC,yBAAyB;AA+C3B,SACEC,aAAa,EACbC,kBAAkB,EAClBC,uBAAuB,EACvBC,QAAQ,EACRC,8BAA8B,EAC9BC,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,WAAW,EACXC,uBAAuB,EACvBC,uBAAuB,EACvBC,sBAAsB,EACtBC,UAAU,EACVC,wBAAwB,EACxBC,eAAe,EACfC,cAAc,EACdC,8BAA8B,EAC9BC,WAAW;AAGb,OAAO,MAAMC,mBAAmB,GAAGxB,GAAG,CAACyB,MAAM,CAAsB;EACjEC,MAAM,EAAEjB,QAAQ;EAChBkB,IAAI,EAAET,UAAU;EAChBU,OAAO,EAAE5B,GAAG,CAACyB,MAAM,CAAC,CAAC,CAACI,QAAQ,CAAC;AACjC,CAAC,CAAC,CACCC,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,wCAAwC,CAAC;AAExD,OAAO,MAAMC,sBAAsB,GAAGR,mBAAmB,CACtDS,MAAM,CAAyB;EAC9BC,KAAK,EAAEX,WAAW;EAClBY,YAAY,EAAEtB,kBAAkB;EAChCuB,QAAQ,EAAEf,cAAc;EACxBgB,SAAS,EAAEjB;AACb,CAAC,CAAC,CACDU,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,gDAAgD,CAAC;AAEhE,OAAO,MAAMO,oBAAoB,GAAGtC,GAAG,CAACyB,MAAM,CAAuB,CAAC,CACnEc,IAAI,CAAC;EACJC,MAAM,EAAExC,GAA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yC,MAAM,CAAC,CAAC,CAACX,QAAQ,CAAC,CAAC;EACjCsI,eAAe,EAAEpK,GAAG,CAACwH,IAAI,CAAC,CAAC,CAAC1F,QAAQ,CAAC;AACvC,CAAC,CAAC,CACDC,WAAW,CAAC,wCAAwC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["Joi","AuditEventMessageCategory","AuditEventMessageSchemaVersion","AuditEventMessageSource","AuditEventMessageType","FormDefinitionRequestType","emailAddressNoUnicodeSchema","contactSchema","emailResponseTimeSchema","idSchema","notificationEmailAddressSchema","onlineTextSchema","onlineUrlSchema","organisationSchema","phoneSchema","privacyNoticeTextSchema","privacyNoticeTypeSchema","privacyNoticeUrlSchema","slugSchema","submissionGuidanceSchema","teamEmailSchema","teamNameSchema","termsAndConditionsAgreedSchema","titleSchema","formMessageDataBase","object","formId","slug","payload","optional","required","description","formCreatedMessageData","append","title","organisation","teamName","teamEmail","formDefinitionS3Meta","keys","fileId","string","filename","s3Key","formUpdatedMessageData","requestType","valid","Object","values","s3Meta","formsBackupRequestedMessageData","totalForms","number","integer","min","durationMs","formsSecretDeletedMessageData","secretName","formsSecretSavedMessageData","dlqActionMessageData","action","messageId","formTitleChanges","formOrganisationChanges","formTeamNameChanges","formTeamEmailChanges","formSupportContactChanges","contact","formSupportPhoneChanges","phone","formSupportOnlineChanges","url","text","formSupportEmailChanges","address","responseTime","formPrivacyNoticeChanges","privacyNoticeType","privacyNoticeText","when","is","then","otherwise","allow","privacyNoticeUrl","formTermsAndConditionsChanges","termsAndConditionsAgreed","formNotificationEmailChanges","notificationEmail","formSubmissionGuidanceChanges","submissionGuidance","formUploadedChanges","value","entitlementMessageData","userId","displayName","email","roles","array","items","formFileDownloadedMessageData","fileLink","excelGenerationMessageData","formName","authenticationMessageData","auditUserSchema","id","formChangesMessageData","schema","changes","previous","new","messageSchema","schemaVersion","category","source","type","entityId","traceId","createdAt","date","createdBy","data","switch","trim","FORM_CREATED","FORM_TITLE_UPDATED","FORM_ORGANISATION_UPDATED","FORM_TEAM_NAME_UPDATED","FORM_TEAM_EMAIL_UPDATED","FORM_SUPPORT_CONTACT_UPDATED","FORM_SUPPORT_PHONE_UPDATED","FORM_SUPPORT_EMAIL_UPDATED","FORM_SUPPORT_ONLINE_UPDATED","FORM_PRIVACY_NOTICE_UPDATED","FORM_TERMS_AND_CONDITIONS_AGREED","FORM_NOTIFICATION_EMAIL_UPDATED","FORM_SUBMISSION_GUIDANCE_UPDATED","FORM_JSON_UPLOADED","FORM_UPDATED","ENTITLEMENT_CREATED","ENTITLEMENT_UPDATED","ENTITLEMENT_DELETED","FORM_DRAFT_DELETED","FORM_JSON_DOWNLOADED","AUTHENTICATION_LOGIN","AUTHENTICATION_LOGOUT_MANUAL","AUTHENTICATION_LOGOUT_AUTO","AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE","FORM_FILE_DOWNLOAD_SUCCESS","FORM_FILE_DOWNLOAD_FAILURE","FORM_SUBMISSION_EXCEL_REQUESTED","FORM_CSAT_EXCEL_REQUESTED","PLATFORM_CSAT_EXCEL_REQUESTED","FORMS_BACKUP_REQUESTED","FORM_SECRET_DELETED","FORM_SECRET_SAVED","DLQ_ACTION","forbidden","messageCreatedAt","auditEvent","message","auditRecord","uuid","recordCreatedAt"],"sources":["../../../../src/form/form-audit/index.ts"],"sourcesContent":["import Joi, { type ObjectSchema } from 'joi'\n\nimport {\n AuditEventMessageCategory,\n AuditEventMessageSchemaVersion,\n AuditEventMessageSource,\n AuditEventMessageType,\n FormDefinitionRequestType\n} from '~/src/form/form-audit/enums.js'\nimport {\n type AuditEvent,\n type AuditMessage,\n type AuditRecord,\n type AuditUser,\n type AuthenticationMessageData,\n type ChangesMessageData,\n type DlqActionMessageData,\n type EntitlementMessageData,\n type ExcelGenerationMessageData,\n type FormCreatedMessageData,\n type FormDefinitionS3Meta,\n type FormFileDownloadedMessageData,\n type FormMessageChangesData,\n type FormMessageDataBase,\n type FormNotificationEmailChanges,\n type FormNotificationEmailUpdatedMessageData,\n type FormOrganisationChanges,\n type FormOrganisationUpdatedMessageData,\n type FormPrivacyNoticeChanges,\n type FormPrivacyNoticeUpdatedMessageData,\n type FormSecretBaseMessageData,\n type FormSubmissionGuidanceChanges,\n type FormSubmissionGuidanceUpdatedMessageData,\n type FormSupportContactChanges,\n type FormSupportContactUpdatedMessageData,\n type FormSupportEmailChanges,\n type FormSupportEmailUpdatedMessageData,\n type FormSupportOnlineChanges,\n type FormSupportOnlineUpdatedMessageData,\n type FormSupportPhoneChanges,\n type FormSupportPhoneUpdatedMessageData,\n type FormTeamEmailChanges,\n type FormTeamEmailUpdatedMessageData,\n type FormTeamNameChanges,\n type FormTeamNameUpdatedMessageData,\n type FormTermsAndConditionsAgreedMessageData,\n type FormTermsAndConditionsChanges,\n type FormTitleChanges,\n type FormTitleUpdatedMessageData,\n type FormUpdatedMessageData,\n type FormUploadedChanges,\n type FormUploadedMessageData,\n type FormsBackupRequestedMessageData\n} from '~/src/form/form-audit/types.js'\nimport { emailAddressNoUnicodeSchema } from '~/src/form/form-editor/index.js'\nimport {\n contactSchema,\n emailResponseTimeSchema,\n idSchema,\n notificationEmailAddressSchema,\n onlineTextSchema,\n onlineUrlSchema,\n organisationSchema,\n phoneSchema,\n privacyNoticeTextSchema,\n privacyNoticeTypeSchema,\n privacyNoticeUrlSchema,\n slugSchema,\n submissionGuidanceSchema,\n teamEmailSchema,\n teamNameSchema,\n termsAndConditionsAgreedSchema,\n titleSchema\n} from '~/src/form/form-metadata/index.js'\n\nexport const formMessageDataBase = Joi.object<FormMessageDataBase>({\n formId: idSchema,\n slug: slugSchema,\n payload: Joi.object().optional()\n})\n .required()\n .description('The base data object for Form Messages')\n\nexport const formCreatedMessageData = formMessageDataBase\n .append<FormCreatedMessageData>({\n title: titleSchema,\n organisation: organisationSchema,\n teamName: teamNameSchema,\n teamEmail: teamEmailSchema\n })\n .required()\n .description('Message data schema for when a form is created')\n\nexport const formDefinitionS3Meta = Joi.object<FormDefinitionS3Meta>()\n .keys({\n fileId: Joi.string().required(),\n filename: Joi.string().required(),\n s3Key: Joi.string().required()\n })\n .description('Schema for form data S3 object in message')\n\nexport const formUpdatedMessageData = formMessageDataBase\n .append<FormUpdatedMessageData>({\n requestType: Joi.string()\n .valid(...Object.values(FormDefinitionRequestType))\n .required(),\n s3Meta: formDefinitionS3Meta.optional()\n })\n .required()\n\nexport const formsBackupRequestedMessageData =\n Joi.object<FormsBackupRequestedMessageData>().keys({\n totalForms: Joi.number().integer().min(0).required(),\n durationMs: Joi.number().min(0).required()\n })\n\nexport const formsSecretDeletedMessageData =\n formMessageDataBase.append<FormSecretBaseMessageData>({\n secretName: Joi.string().required()\n })\n\nexport const formsSecretSavedMessageData =\n formMessageDataBase.append<FormSecretBaseMessageData>({\n secretName: Joi.string().required()\n })\n\nexport const dlqActionMessageData = Joi.object<DlqActionMessageData>().keys({\n action: Joi.string().valid('redrive', 'delete').required(),\n messageId: Joi.string().optional()\n})\n\nexport const formTitleChanges = Joi.object<FormTitleChanges>()\n .keys({\n title: titleSchema\n })\n .required()\n .description('Changes schema for FORM_TITLE_UPDATED event')\n\nexport const formOrganisationChanges = Joi.object<FormOrganisationChanges>()\n .keys({\n organisation: organisationSchema\n })\n .required()\n .description('Changes schema for FORM_ORGANISATION_UPDATED event')\n\nexport const formTeamNameChanges = Joi.object<FormTeamNameChanges>()\n .keys({\n teamName: teamNameSchema\n })\n .required()\n .description('Changes schema for FORM_TEAM_NAME_UPDATED event')\n\nexport const formTeamEmailChanges = Joi.object<FormTeamEmailChanges>()\n .keys({\n teamEmail: teamEmailSchema\n })\n .required()\n .description('Changes schema for FORM_TEAM_EMAIL_UPDATED event')\n\nexport const formSupportContactChanges = Joi.object<FormSupportContactChanges>()\n .keys({\n contact: contactSchema\n })\n .required()\n .description('Changes schema for FORM_SUPPORT_CONTACT_UPDATED event')\n\nexport const formSupportPhoneChanges = Joi.object<FormSupportPhoneChanges>()\n .keys({\n phone: phoneSchema\n })\n .required()\n .description('Changes schema for FORM_SUPPORT_PHONE_UPDATED event')\n\nexport const formSupportOnlineChanges = Joi.object<FormSupportOnlineChanges>()\n .keys({\n url: onlineUrlSchema.optional(),\n text: onlineTextSchema.optional()\n })\n .required()\n .description('Changes schema for FORM_SUPPORT_ONLINE_UPDATED event')\n\nexport const formSupportEmailChanges = Joi.object<FormSupportEmailChanges>()\n .keys({\n address: emailAddressNoUnicodeSchema.optional(),\n responseTime: emailResponseTimeSchema.optional()\n })\n .description('Changes schema for FORM_SUPPORT_EMAIL_UPDATED event')\n\nexport const formPrivacyNoticeChanges = Joi.object<FormPrivacyNoticeChanges>()\n .keys({\n privacyNoticeType: privacyNoticeTypeSchema,\n privacyNoticeText: Joi.when('privacyNoticeType', {\n is: 'text',\n then: privacyNoticeTextSchema,\n otherwise: privacyNoticeTextSchema.allow('')\n }),\n privacyNoticeUrl: Joi.when('privacyNoticeType', {\n is: 'link',\n then: privacyNoticeUrlSchema,\n otherwise: privacyNoticeUrlSchema.allow('')\n })\n })\n .required()\n .description('Changes schema for FORM_PRIVACY_NOTICE_UPDATED event')\n\nexport const formTermsAndConditionsChanges =\n Joi.object<FormTermsAndConditionsChanges>()\n .keys({\n termsAndConditionsAgreed: termsAndConditionsAgreedSchema\n })\n .required()\n .description('Changes schema for FORM_TERMS_AND_CONDITIONS_AGREED event')\n\nexport const formNotificationEmailChanges =\n Joi.object<FormNotificationEmailChanges>()\n .keys({\n notificationEmail: notificationEmailAddressSchema\n })\n .required()\n .description('Changes schema for FORM_NOTIFICATION_EMAIL_UPDATED event')\n\nexport const formSubmissionGuidanceChanges =\n Joi.object<FormSubmissionGuidanceChanges>()\n .keys({\n submissionGuidance: submissionGuidanceSchema\n })\n .required()\n .description('Changes schema for FORM_SUBMISSION_GUIDANCE_UPDATED event')\n\nexport const formUploadedChanges = Joi.object<FormUploadedChanges>()\n .keys({\n value: Joi.string().required()\n })\n .required()\n .description('Changes schema for FORM_JSON_UPLOADED event')\n\nexport const entitlementMessageData = Joi.object<EntitlementMessageData>().keys(\n {\n userId: Joi.string().required(),\n displayName: Joi.string().required(),\n email: emailAddressNoUnicodeSchema.required(),\n roles: Joi.array().items(Joi.string())\n }\n)\n\nexport const formFileDownloadedMessageData =\n Joi.object<FormFileDownloadedMessageData>()\n .keys({\n fileId: Joi.string().required(),\n filename: Joi.string().required(),\n fileLink: Joi.string().required()\n })\n .required()\n .description(\n 'Schema for FORM_FILE_DOWNLOAD_SUCCESS and FORM_FILE_DOWNLOAD_FAILURE events'\n )\n\nexport const excelGenerationMessageData =\n Joi.object<ExcelGenerationMessageData>()\n .keys({\n formId: Joi.string().required(),\n formName: Joi.string().required(),\n notificationEmail: emailAddressNoUnicodeSchema.required()\n })\n .required()\n .description(\n 'Schema for Excel generation audit events (submissions and CSAT)'\n )\n\nexport const authenticationMessageData =\n Joi.object<AuthenticationMessageData>().keys({\n userId: Joi.string().required(),\n displayName: Joi.string().required()\n })\n\nexport const auditUserSchema = Joi.object<AuditUser>()\n .keys({\n id: Joi.string().required(),\n displayName: Joi.string().required()\n })\n .description('Schema for CREATED_BY audit event')\n\nexport function formChangesMessageData<T, U extends FormMessageChangesData>(\n schema: ObjectSchema<T>\n): ObjectSchema<U> {\n return formMessageDataBase.append<U>({\n changes: Joi.object<ChangesMessageData<T>>()\n .keys({\n previous: schema,\n new: schema\n })\n .description('Changes schema')\n })\n}\n\nexport const messageSchema = Joi.object<AuditMessage>()\n .keys({\n schemaVersion: Joi.string()\n .valid(...Object.values(AuditEventMessageSchemaVersion))\n .required()\n .description(\n 'The version of the AuditMessage - bumped with breaking changes'\n ),\n category: Joi.string()\n .valid(...Object.values(AuditEventMessageCategory))\n .required()\n .description('The message category - what does the entityId represent?'),\n source: Joi.string()\n .valid(...Object.values(AuditEventMessageSource))\n .required()\n .description('Source of the message - which service?'),\n type: Joi.string()\n .valid(...Object.values(AuditEventMessageType))\n .description('Event type'),\n entityId: Joi.string()\n .required()\n .description('The id of the entity the category relates to'),\n traceId: Joi.string()\n .optional()\n .description(\n 'Trace id of the event - to link events across multiple services'\n ),\n createdAt: Joi.date()\n .required()\n .description(\n 'The ISO timestamp where the action took place - should be the same as updated_at field in DB'\n ),\n createdBy: auditUserSchema\n .required()\n .description('The user who performed the action being audited'),\n data: Joi.when('type', {\n switch: [\n {\n is: Joi.string().trim().valid(AuditEventMessageType.FORM_CREATED),\n then: formCreatedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_TITLE_UPDATED),\n then: formChangesMessageData<\n FormTitleChanges,\n FormTitleUpdatedMessageData\n >(formTitleChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_ORGANISATION_UPDATED),\n then: formChangesMessageData<\n FormOrganisationChanges,\n FormOrganisationUpdatedMessageData\n >(formOrganisationChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_TEAM_NAME_UPDATED),\n then: formChangesMessageData<\n FormTeamNameChanges,\n FormTeamNameUpdatedMessageData\n >(formTeamNameChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_TEAM_EMAIL_UPDATED),\n then: formChangesMessageData<\n FormTeamEmailChanges,\n FormTeamEmailUpdatedMessageData\n >(formTeamEmailChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUPPORT_CONTACT_UPDATED),\n then: formChangesMessageData<\n FormSupportContactChanges,\n FormSupportContactUpdatedMessageData\n >(formSupportContactChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUPPORT_PHONE_UPDATED),\n then: formChangesMessageData<\n FormSupportPhoneChanges,\n FormSupportPhoneUpdatedMessageData\n >(formSupportPhoneChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUPPORT_EMAIL_UPDATED),\n then: formChangesMessageData<\n FormSupportEmailChanges,\n FormSupportEmailUpdatedMessageData\n >(formSupportEmailChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUPPORT_ONLINE_UPDATED),\n then: formChangesMessageData<\n FormSupportOnlineChanges,\n FormSupportOnlineUpdatedMessageData\n >(formSupportOnlineChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_PRIVACY_NOTICE_UPDATED),\n then: formChangesMessageData<\n FormPrivacyNoticeChanges,\n FormPrivacyNoticeUpdatedMessageData\n >(formPrivacyNoticeChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_TERMS_AND_CONDITIONS_AGREED),\n then: formChangesMessageData<\n FormTermsAndConditionsChanges,\n FormTermsAndConditionsAgreedMessageData\n >(formTermsAndConditionsChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_NOTIFICATION_EMAIL_UPDATED),\n then: formChangesMessageData<\n FormNotificationEmailChanges,\n FormNotificationEmailUpdatedMessageData\n >(formNotificationEmailChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SUBMISSION_GUIDANCE_UPDATED),\n then: formChangesMessageData<\n FormSubmissionGuidanceChanges,\n FormSubmissionGuidanceUpdatedMessageData\n >(formSubmissionGuidanceChanges)\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_JSON_UPLOADED),\n then: formChangesMessageData<\n FormUploadedChanges,\n FormUploadedMessageData\n >(formUploadedChanges)\n },\n {\n is: Joi.string().trim().valid(AuditEventMessageType.FORM_UPDATED),\n then: formUpdatedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(\n AuditEventMessageType.ENTITLEMENT_CREATED,\n AuditEventMessageType.ENTITLEMENT_UPDATED,\n AuditEventMessageType.ENTITLEMENT_DELETED\n ),\n then: entitlementMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_DRAFT_DELETED),\n then: formMessageDataBase\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_JSON_DOWNLOADED),\n then: formMessageDataBase\n },\n {\n is: Joi.string()\n .trim()\n .valid(\n AuditEventMessageType.AUTHENTICATION_LOGIN,\n AuditEventMessageType.AUTHENTICATION_LOGOUT_MANUAL,\n AuditEventMessageType.AUTHENTICATION_LOGOUT_AUTO,\n AuditEventMessageType.AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE\n ),\n then: authenticationMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(\n AuditEventMessageType.FORM_FILE_DOWNLOAD_SUCCESS,\n AuditEventMessageType.FORM_FILE_DOWNLOAD_FAILURE\n ),\n then: formFileDownloadedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(\n AuditEventMessageType.FORM_SUBMISSION_EXCEL_REQUESTED,\n AuditEventMessageType.FORM_CSAT_EXCEL_REQUESTED,\n AuditEventMessageType.PLATFORM_CSAT_EXCEL_REQUESTED\n ),\n then: excelGenerationMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORMS_BACKUP_REQUESTED),\n then: formsBackupRequestedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SECRET_DELETED),\n then: formsSecretDeletedMessageData\n },\n {\n is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_SECRET_SAVED),\n then: formsSecretSavedMessageData\n },\n {\n is: Joi.string().trim().valid(AuditEventMessageType.DLQ_ACTION),\n then: dlqActionMessageData\n }\n ],\n otherwise: Joi.forbidden()\n }).description('The data/payload of the audit message'),\n messageCreatedAt: Joi.date()\n .required()\n .description('ISO timestamp when the message was published')\n })\n .required()\n .description('The audit message issued by the publishing service')\n\nexport const auditEvent = Joi.object<AuditEvent>()\n .keys({\n message: messageSchema\n })\n .description('The Body of the audit event')\n\nexport const auditRecord = messageSchema\n .append<AuditRecord>({\n id: idSchema,\n messageId: Joi.string().uuid().required(),\n entityId: Joi.string().required(),\n recordCreatedAt: Joi.date().required()\n })\n .description('The audit record persisted into the DB')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MappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","names":["MIN_NUMBER_OF_REPEAT_ITEMS","MAX_NUMBER_OF_REPEAT_ITEMS"],"sources":["../../../../src/form/form-definition/constants.ts"],"sourcesContent":["export const MIN_NUMBER_OF_REPEAT_ITEMS = 1\nexport const MAX_NUMBER_OF_REPEAT_ITEMS = 200\n"],"mappings":"AAAA,OAAO,MAAMA,0BAA0B,GAAG,CAAC;AAC3C,OAAO,MAAMC,0BAA0B,GAAG,GAAG","ignoreList":[]}
@@ -5,8 +5,10 @@ import { rtrimOnly } from "../../common/rtrim-only.js";
5
5
  import { ComponentType } from "../../components/enums.js";
6
6
  import { isConditionalType } from "../../components/helpers.js";
7
7
  import { ConditionType, OperatorName } from "../../conditions/enums.js";
8
+ import { MAX_NUMBER_OF_REPEAT_ITEMS, MIN_NUMBER_OF_REPEAT_ITEMS } from "./constants.js";
8
9
  import { isConditionListItemRefValueData, isFormDefinition } from "./helpers.js";
9
10
  import { SchemaVersion } from "./types.js";
11
+ import { emailAddressNoUnicodeSchema } from "../form-editor/index.js";
10
12
  import { checkErrors } from "../form-manager/errors.js";
11
13
  import { FormDefinitionError, FormDefinitionErrorType } from "../form-manager/types.js";
12
14
  import { ControllerType } from "../../pages/enums.js";
@@ -132,8 +134,6 @@ const conditionSchema = Joi.object().description('Condition definition specifyin
132
134
  value: Joi.alternatives().try(conditionValueSchema, relativeDateValueDataSchema).description('Value to compare the field against, either fixed or relative date'),
133
135
  coordinator: Joi.string().trim().optional().description('Logical operator connecting this condition with others (AND, OR)')
134
136
  });
135
- export const MIN_NUMBER_OF_REPEAT_ITEMS = 1;
136
- export const MAX_NUMBER_OF_REPEAT_ITEMS = 200;
137
137
  export const conditionDataSchemaV2 = Joi.object().description('Condition definition').keys({
138
138
  id: idSchema.description('Unique identifier used to reference this condition'),
139
139
  componentId: Joi.string().trim().required().when('/pages', {
@@ -397,11 +397,7 @@ export const sectionsSchemaV2 = sectionsSchema.keys({
397
397
  }).description('Section schema for V2 forms');
398
398
  const feedbackSchema = Joi.object().description('Feedback configuration for the form').keys({
399
399
  url: Joi.string().trim().optional().allow('').description('URL to an external feedback form when not using built-in feedback'),
400
- emailAddress: Joi.string().trim().email({
401
- tlds: {
402
- allow: false
403
- }
404
- }).optional().description('Email address where feedback is sent')
400
+ emailAddress: emailAddressNoUnicodeSchema.optional().description('Email address where feedback is sent')
405
401
  });
406
402
  const phaseBannerSchema = Joi.object().description('Phase banner configuration showing development status').keys({
407
403
  phase: Joi.string().trim().valid('alpha', 'beta').description('Development phase of the service (alpha or beta)')
@@ -436,14 +432,14 @@ export const formDefinitionSchema = Joi.object().description('Complete form defi
436
432
  skipSummary: Joi.any().strip().description('option to skip the summary page'),
437
433
  phaseBanner: phaseBannerSchema.optional().description('Phase banner configuration'),
438
434
  options: optionsSchema.optional().description('Options for the form'),
439
- outputEmail: Joi.string().trim().email({
435
+ outputEmail: emailAddressNoUnicodeSchema.email({
440
436
  tlds: {
441
437
  allow: ['uk']
442
438
  }
443
439
  }).optional().description('Email address where form submissions are sent'),
444
440
  output: outputSchema.optional().description('Configuration for submission output format'),
445
441
  outputs: Joi.array().items({
446
- emailAddress: Joi.string().trim().email({
442
+ emailAddress: emailAddressNoUnicodeSchema.email({
447
443
  tlds: {
448
444
  allow: ['uk']
449
445
  }
@@ -459,6 +455,7 @@ export const formDefinitionV2Schema = formDefinitionSchema.keys({
459
455
  conditions: Joi.array().items(conditionWrapperSchemaV2).unique('id').unique('displayName').description('Named conditions used for form logic').error(checkErrors([FormDefinitionError.UniqueConditionId, FormDefinitionError.UniqueConditionDisplayName])),
460
456
  sections: Joi.array().items(sectionsSchemaV2).unique('id').unique('name').unique('title').required().description('Sections schema for V2 forms').error(checkErrors([FormDefinitionError.UniqueSectionId, FormDefinitionError.UniqueSectionName, FormDefinitionError.UniqueSectionTitle]))
461
457
  }).description('Form definition schema for V2');
458
+ export { MAX_NUMBER_OF_REPEAT_ITEMS, MIN_NUMBER_OF_REPEAT_ITEMS } from "./constants.js";
462
459
 
463
460
  // Maintain compatibility with legacy named export
464
461
  // E.g. `import { Schema } from '@defra/forms-model'`