@defra/forms-model 4.0.1 → 4.0.3

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 (30) hide show
  1. package/dist/module/form/form-audit/enums.js +12 -1
  2. package/dist/module/form/form-audit/enums.js.map +1 -1
  3. package/dist/module/form/form-audit/index.js +20 -0
  4. package/dist/module/form/form-audit/index.js.map +1 -1
  5. package/dist/module/form/form-audit/types.js.map +1 -1
  6. package/dist/module/form/form-definition/constants.js +1 -0
  7. package/dist/module/form/form-definition/constants.js.map +1 -1
  8. package/dist/module/form/form-definition/helpers.js +30 -0
  9. package/dist/module/form/form-definition/helpers.js.map +1 -1
  10. package/dist/module/form/form-definition/index.js +1 -1
  11. package/dist/module/form/form-definition/index.js.map +1 -1
  12. package/dist/types/form/form-audit/enums.d.ts +12 -2
  13. package/dist/types/form/form-audit/enums.d.ts.map +1 -1
  14. package/dist/types/form/form-audit/index.d.ts +2 -1
  15. package/dist/types/form/form-audit/index.d.ts.map +1 -1
  16. package/dist/types/form/form-audit/types.d.ts +61 -2
  17. package/dist/types/form/form-audit/types.d.ts.map +1 -1
  18. package/dist/types/form/form-definition/constants.d.ts +1 -0
  19. package/dist/types/form/form-definition/constants.d.ts.map +1 -1
  20. package/dist/types/form/form-definition/helpers.d.ts +23 -0
  21. package/dist/types/form/form-definition/helpers.d.ts.map +1 -1
  22. package/dist/types/form/form-definition/index.d.ts +1 -1
  23. package/dist/types/form/form-definition/index.d.ts.map +1 -1
  24. package/package.json +2 -2
  25. package/src/form/form-audit/enums.ts +15 -3
  26. package/src/form/form-audit/index.ts +36 -1
  27. package/src/form/form-audit/types.ts +80 -0
  28. package/src/form/form-definition/constants.ts +2 -0
  29. package/src/form/form-definition/helpers.ts +49 -0
  30. package/src/form/form-definition/index.ts +1 -0
@@ -14,6 +14,7 @@ export let AuditEventMessageSource = /*#__PURE__*/function (AuditEventMessageSou
14
14
  AuditEventMessageSource["FORMS_DESIGNER"] = "FORMS_DESIGNER";
15
15
  AuditEventMessageSource["ENTITLEMENT"] = "ENTITLEMENT";
16
16
  AuditEventMessageSource["AUTHENTICATION"] = "AUTHENTICATION";
17
+ AuditEventMessageSource["FORMS_IDENTITY"] = "FORMS_IDENTITY";
17
18
  return AuditEventMessageSource;
18
19
  }({});
19
20
  export let AuditEventMessageType = /*#__PURE__*/function (AuditEventMessageType) {
@@ -52,13 +53,23 @@ export let AuditEventMessageType = /*#__PURE__*/function (AuditEventMessageType)
52
53
  AuditEventMessageType["ENTITLEMENT_CREATED"] = "ENTITLEMENT_CREATED";
53
54
  AuditEventMessageType["ENTITLEMENT_UPDATED"] = "ENTITLEMENT_UPDATED";
54
55
  AuditEventMessageType["ENTITLEMENT_DELETED"] = "ENTITLEMENT_DELETED";
55
- // AUTHENTICATION message types
56
+ // AUTHENTICATION message types - for forms-designer
56
57
  AuditEventMessageType["AUTHENTICATION_LOGIN"] = "AUTHENTICATION_LOGIN";
57
58
  AuditEventMessageType["AUTHENTICATION_LOGOUT_MANUAL"] = "AUTHENTICATION_LOGOUT_MANUAL";
58
59
  AuditEventMessageType["AUTHENTICATION_LOGOUT_AUTO"] = "AUTHENTICATION_LOGOUT_AUTO";
59
60
  AuditEventMessageType["AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE"] = "AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE";
60
61
  // Dead-letter queue types
61
62
  AuditEventMessageType["DLQ_ACTION"] = "DLQ_ACTION";
63
+ // IDENTITY message types - for forms-identity-api
64
+ AuditEventMessageType["IDENTITY_SIGN_IN_SUCCESSFUL"] = "IDENTITY_SIGN_IN_SUCCESSFUL";
65
+ AuditEventMessageType["IDENTITY_SIGN_OUT"] = "IDENTITY_SIGN_OUT";
66
+ AuditEventMessageType["IDENTITY_REGISTRATION"] = "IDENTITY_REGISTRATION";
67
+ AuditEventMessageType["IDENTITY_TOO_MANY_OTPS_REQUESTED"] = "IDENTITY_TOO_MANY_OTPS_REQUESTED";
68
+ AuditEventMessageType["IDENTITY_INCORRECT_CODE_ENTERED"] = "IDENTITY_INCORRECT_CODE_ENTERED";
69
+ AuditEventMessageType["IDENTITY_INCORRECT_CODE_LOCKOUT"] = "IDENTITY_INCORRECT_CODE_LOCKOUT";
70
+ AuditEventMessageType["IDENTITY_ACCOUNT_DELETION"] = "IDENTITY_ACCOUNT_DELETION";
71
+ AuditEventMessageType["IDENTITY_EMAIL_ADDRESS_UPDATED"] = "IDENTITY_EMAIL_ADDRESS_UPDATED";
72
+ AuditEventMessageType["IDENTITY_PHONE_NUMBER_UPDATED"] = "IDENTITY_PHONE_NUMBER_UPDATED";
62
73
  return AuditEventMessageType;
63
74
  }({});
64
75
  export let FormDefinitionRequestType = /*#__PURE__*/function (FormDefinitionRequestType) {
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","names":["AuditEventMessageSchemaVersion","AuditEventMessageCategory","AuditEventMessageSource","AuditEventMessageType","FormDefinitionRequestType"],"sources":["../../../../src/form/form-audit/enums.ts"],"sourcesContent":["export enum AuditEventMessageSchemaVersion {\n V1 = 1\n}\n\nexport enum AuditEventMessageCategory {\n FORM = 'FORM',\n ENTITLEMENT = 'ENTITLEMENT',\n AUTHENTICATION = 'AUTHENTICATION',\n OPERATIONS = 'OPERATIONS'\n}\n\nexport enum AuditEventMessageSource {\n FORMS_MANAGER = 'FORMS_MANAGER',\n FORMS_DESIGNER = 'FORMS_DESIGNER',\n ENTITLEMENT = 'ENTITLEMENT',\n AUTHENTICATION = 'AUTHENTICATION'\n}\n\nexport enum AuditEventMessageType {\n // FORM message types\n FORM_CREATED = 'FORM_CREATED',\n FORM_TITLE_UPDATED = 'FORM_TITLE_UPDATED',\n FORM_ORGANISATION_UPDATED = 'FORM_ORGANISATION_UPDATED',\n FORM_TEAM_NAME_UPDATED = 'FORM_TEAM_NAME_UPDATED',\n FORM_TEAM_EMAIL_UPDATED = 'FORM_TEAM_EMAIL_UPDATED',\n FORM_SUPPORT_CONTACT_UPDATED = 'FORM_SUPPORT_CONTACT_UPDATED',\n FORM_SUPPORT_PHONE_UPDATED = 'FORM_SUPPORT_PHONE_UPDATED',\n FORM_SUPPORT_EMAIL_UPDATED = 'FORM_SUPPORT_EMAIL_UPDATED',\n FORM_SUPPORT_ONLINE_UPDATED = 'FORM_SUPPORT_ONLINE_UPDATED',\n FORM_PRIVACY_NOTICE_UPDATED = 'FORM_PRIVACY_NOTICE_UPDATED',\n FORM_TERMS_AND_CONDITIONS_AGREED = 'FORM_TERMS_AND_CONDITIONS_AGREED',\n FORM_NOTIFICATION_EMAIL_UPDATED = 'FORM_NOTIFICATION_EMAIL_UPDATED',\n FORM_SUBMISSION_GUIDANCE_UPDATED = 'FORM_SUBMISSION_GUIDANCE_UPDATED',\n FORM_JSON_UPLOADED = 'FORM_JSON_UPLOADED',\n FORM_JSON_DOWNLOADED = 'FORM_JSON_DOWNLOADED',\n FORM_FILE_DOWNLOAD_SUCCESS = 'FORM_FILE_DOWNLOAD_SUCCESS',\n FORM_FILE_DOWNLOAD_FAILURE = 'FORM_FILE_DOWNLOAD_FAILURE',\n FORM_DRAFT_CREATED_FROM_LIVE = 'FORM_DRAFT_CREATED_FROM_LIVE',\n FORM_LIVE_CREATED_FROM_DRAFT = 'FORM_LIVE_CREATED_FROM_DRAFT',\n FORM_DRAFT_DELETED = 'FORM_DRAFT_DELETED',\n FORM_OFFLINE_UPDATED = 'FORM_OFFLINE_UPDATED',\n FORM_MIGRATED = 'FORM_MIGRATED',\n FORM_UPDATED = 'FORM_UPDATED',\n FORM_SECRET_DELETED = 'FORM_SECRET_DELETED',\n FORM_SECRET_SAVED = 'FORM_SECRET_SAVED',\n FORM_SUBMISSION_EXCEL_REQUESTED = 'FORM_SUBMISSION_EXCEL_REQUESTED',\n FORM_CSAT_EXCEL_REQUESTED = 'FORM_CSAT_EXCEL_REQUESTED',\n FORMS_BACKUP_REQUESTED = 'FORMS_BACKUP_REQUESTED',\n PLATFORM_CSAT_EXCEL_REQUESTED = 'PLATFORM_CSAT_EXCEL_REQUESTED',\n PLATFORM_METRICS_DOWNLOAD_REQUESTED = 'PLATFORM_METRICS_DOWNLOAD_REQUESTED',\n\n // ENTITLEMENT message types\n ENTITLEMENT_CREATED = 'ENTITLEMENT_CREATED',\n ENTITLEMENT_UPDATED = 'ENTITLEMENT_UPDATED',\n ENTITLEMENT_DELETED = 'ENTITLEMENT_DELETED',\n\n // AUTHENTICATION message types\n AUTHENTICATION_LOGIN = 'AUTHENTICATION_LOGIN',\n AUTHENTICATION_LOGOUT_MANUAL = 'AUTHENTICATION_LOGOUT_MANUAL',\n AUTHENTICATION_LOGOUT_AUTO = 'AUTHENTICATION_LOGOUT_AUTO',\n AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE = 'AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE',\n\n // Dead-letter queue types\n DLQ_ACTION = 'DLQ_ACTION'\n}\n\nexport enum FormDefinitionRequestType {\n REPLACE_DRAFT = 'REPLACE_DRAFT',\n CREATE_COMPONENT = 'CREATE_COMPONENT',\n UPDATE_COMPONENT = 'UPDATE_COMPONENT',\n DELETE_COMPONENT = 'DELETE_COMPONENT',\n CREATE_CONDITION = 'CREATE_CONDITION',\n UPDATE_CONDITION = 'UPDATE_CONDITION',\n DELETE_CONDITION = 'DELETE_CONDITION',\n REORDER_PAGES = 'REORDER_PAGES',\n REORDER_COMPONENTS = 'REORDER_COMPONENTS',\n REORDER_SECTIONS = 'REORDER_SECTIONS',\n CREATE_LIST = 'CREATE_LIST',\n UPDATE_LIST = 'UPDATE_LIST',\n DELETE_LIST = 'DELETE_LIST',\n CREATE_PAGE = 'CREATE_PAGE',\n UPDATE_PAGE_FIELDS = 'UPDATE_PAGE_FIELDS',\n DELETE_PAGE = 'DELETE_PAGE',\n REPOSITION_SUMMARY = 'REPOSITION_SUMMARY',\n CREATE_SECTION = 'CREATE_SECTION',\n DELETE_SECTION = 'DELETE_SECTION',\n RENAME_SECTION = 'RENAME_SECTION',\n ASSIGN_SECTIONS = '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AyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"enums.js","names":["AuditEventMessageSchemaVersion","AuditEventMessageCategory","AuditEventMessageSource","AuditEventMessageType","FormDefinitionRequestType"],"sources":["../../../../src/form/form-audit/enums.ts"],"sourcesContent":["export enum AuditEventMessageSchemaVersion {\n V1 = 1\n}\n\nexport enum AuditEventMessageCategory {\n FORM = 'FORM',\n ENTITLEMENT = 'ENTITLEMENT',\n AUTHENTICATION = 'AUTHENTICATION',\n OPERATIONS = 'OPERATIONS'\n}\n\nexport enum AuditEventMessageSource {\n FORMS_MANAGER = 'FORMS_MANAGER',\n FORMS_DESIGNER = 'FORMS_DESIGNER',\n ENTITLEMENT = 'ENTITLEMENT',\n AUTHENTICATION = 'AUTHENTICATION',\n FORMS_IDENTITY = 'FORMS_IDENTITY'\n}\n\nexport enum AuditEventMessageType {\n // FORM message types\n FORM_CREATED = 'FORM_CREATED',\n FORM_TITLE_UPDATED = 'FORM_TITLE_UPDATED',\n FORM_ORGANISATION_UPDATED = 'FORM_ORGANISATION_UPDATED',\n FORM_TEAM_NAME_UPDATED = 'FORM_TEAM_NAME_UPDATED',\n FORM_TEAM_EMAIL_UPDATED = 'FORM_TEAM_EMAIL_UPDATED',\n FORM_SUPPORT_CONTACT_UPDATED = 'FORM_SUPPORT_CONTACT_UPDATED',\n FORM_SUPPORT_PHONE_UPDATED = 'FORM_SUPPORT_PHONE_UPDATED',\n FORM_SUPPORT_EMAIL_UPDATED = 'FORM_SUPPORT_EMAIL_UPDATED',\n FORM_SUPPORT_ONLINE_UPDATED = 'FORM_SUPPORT_ONLINE_UPDATED',\n FORM_PRIVACY_NOTICE_UPDATED = 'FORM_PRIVACY_NOTICE_UPDATED',\n FORM_TERMS_AND_CONDITIONS_AGREED = 'FORM_TERMS_AND_CONDITIONS_AGREED',\n FORM_NOTIFICATION_EMAIL_UPDATED = 'FORM_NOTIFICATION_EMAIL_UPDATED',\n FORM_SUBMISSION_GUIDANCE_UPDATED = 'FORM_SUBMISSION_GUIDANCE_UPDATED',\n FORM_JSON_UPLOADED = 'FORM_JSON_UPLOADED',\n FORM_JSON_DOWNLOADED = 'FORM_JSON_DOWNLOADED',\n FORM_FILE_DOWNLOAD_SUCCESS = 'FORM_FILE_DOWNLOAD_SUCCESS',\n FORM_FILE_DOWNLOAD_FAILURE = 'FORM_FILE_DOWNLOAD_FAILURE',\n FORM_DRAFT_CREATED_FROM_LIVE = 'FORM_DRAFT_CREATED_FROM_LIVE',\n FORM_LIVE_CREATED_FROM_DRAFT = 'FORM_LIVE_CREATED_FROM_DRAFT',\n FORM_DRAFT_DELETED = 'FORM_DRAFT_DELETED',\n FORM_OFFLINE_UPDATED = 'FORM_OFFLINE_UPDATED',\n FORM_MIGRATED = 'FORM_MIGRATED',\n FORM_UPDATED = 'FORM_UPDATED',\n FORM_SECRET_DELETED = 'FORM_SECRET_DELETED',\n FORM_SECRET_SAVED = 'FORM_SECRET_SAVED',\n FORM_SUBMISSION_EXCEL_REQUESTED = 'FORM_SUBMISSION_EXCEL_REQUESTED',\n FORM_CSAT_EXCEL_REQUESTED = 'FORM_CSAT_EXCEL_REQUESTED',\n FORMS_BACKUP_REQUESTED = 'FORMS_BACKUP_REQUESTED',\n PLATFORM_CSAT_EXCEL_REQUESTED = 'PLATFORM_CSAT_EXCEL_REQUESTED',\n PLATFORM_METRICS_DOWNLOAD_REQUESTED = 'PLATFORM_METRICS_DOWNLOAD_REQUESTED',\n\n // ENTITLEMENT message types\n ENTITLEMENT_CREATED = 'ENTITLEMENT_CREATED',\n ENTITLEMENT_UPDATED = 'ENTITLEMENT_UPDATED',\n ENTITLEMENT_DELETED = 'ENTITLEMENT_DELETED',\n\n // AUTHENTICATION message types - for forms-designer\n AUTHENTICATION_LOGIN = 'AUTHENTICATION_LOGIN',\n AUTHENTICATION_LOGOUT_MANUAL = 'AUTHENTICATION_LOGOUT_MANUAL',\n AUTHENTICATION_LOGOUT_AUTO = 'AUTHENTICATION_LOGOUT_AUTO',\n AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE = 'AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE',\n\n // Dead-letter queue types\n DLQ_ACTION = 'DLQ_ACTION',\n\n // IDENTITY message types - for forms-identity-api\n IDENTITY_SIGN_IN_SUCCESSFUL = 'IDENTITY_SIGN_IN_SUCCESSFUL',\n IDENTITY_SIGN_OUT = 'IDENTITY_SIGN_OUT',\n IDENTITY_REGISTRATION = 'IDENTITY_REGISTRATION',\n IDENTITY_TOO_MANY_OTPS_REQUESTED = 'IDENTITY_TOO_MANY_OTPS_REQUESTED',\n IDENTITY_INCORRECT_CODE_ENTERED = 'IDENTITY_INCORRECT_CODE_ENTERED',\n IDENTITY_INCORRECT_CODE_LOCKOUT = 'IDENTITY_INCORRECT_CODE_LOCKOUT',\n IDENTITY_ACCOUNT_DELETION = 'IDENTITY_ACCOUNT_DELETION',\n IDENTITY_EMAIL_ADDRESS_UPDATED = 'IDENTITY_EMAIL_ADDRESS_UPDATED',\n IDENTITY_PHONE_NUMBER_UPDATED = 'IDENTITY_PHONE_NUMBER_UPDATED'\n}\n\nexport enum FormDefinitionRequestType {\n REPLACE_DRAFT = 'REPLACE_DRAFT',\n CREATE_COMPONENT = 'CREATE_COMPONENT',\n UPDATE_COMPONENT = 'UPDATE_COMPONENT',\n DELETE_COMPONENT = 'DELETE_COMPONENT',\n CREATE_CONDITION = 'CREATE_CONDITION',\n UPDATE_CONDITION = 'UPDATE_CONDITION',\n DELETE_CONDITION = 'DELETE_CONDITION',\n REORDER_PAGES = 'REORDER_PAGES',\n REORDER_COMPONENTS = 'REORDER_COMPONENTS',\n REORDER_SECTIONS = 'REORDER_SECTIONS',\n CREATE_LIST = 'CREATE_LIST',\n UPDATE_LIST = 'UPDATE_LIST',\n DELETE_LIST = 'DELETE_LIST',\n CREATE_PAGE = 'CREATE_PAGE',\n UPDATE_PAGE_FIELDS = 'UPDATE_PAGE_FIELDS',\n DELETE_PAGE = 'DELETE_PAGE',\n REPOSITION_SUMMARY = 'REPOSITION_SUMMARY',\n CREATE_SECTION = 'CREATE_SECTION',\n DELETE_SECTION = 'DELETE_SECTION',\n RENAME_SECTION = 'RENAME_SECTION',\n ASSIGN_SECTIONS = 'ASSIGN_SECTIONS',\n UNASSIGN_SECTIONS = 'UNASSIGN_SECTIONS',\n UPDATE_OPTION = 'UPDATE_OPTION'\n}\n"],"mappings":"AAAA,WAAYA,8BAA8B,0BAA9BA,8BAA8B;EAA9BA,8BAA8B,CAA9BA,8BAA8B;EAAA,OAA9BA,8BAA8B;AAAA;AAI1C,WAAYC,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AAOrC,WAAYC,uBAAuB,0BAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AAQnC,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAC/B;EADUA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAiC/B;EAjCUA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAsC/B;EAtCUA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EA4C/B;EA5CUA,qBAAqB;EA+C/B;EA/CUA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AA2DjC,WAAYC,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA","ignoreList":[]}
@@ -137,6 +137,23 @@ export const auditUserSchema = Joi.object().keys({
137
137
  id: Joi.string().required(),
138
138
  displayName: Joi.string().required()
139
139
  }).description('Schema for CREATED_BY audit event');
140
+ export const identityMessageData = Joi.object().keys({
141
+ // accountId may not always be available
142
+ accountId: Joi.string().optional(),
143
+ // Email address associated with the identity, if any, or the target for an OTP
144
+ email: Joi.string().optional(),
145
+ // Phone number associated with the identity, if any, or the target for an OTP
146
+ phone: Joi.string().optional(),
147
+ // Purpose of the identity interaction, if any
148
+ purpose: Joi.string().optional(),
149
+ // Unique interaction id
150
+ uid: Joi.string().optional(),
151
+ // Changed fields in the identity, if any have changed
152
+ changed: Joi.object({
153
+ old: Joi.string().required(),
154
+ new: Joi.string().required()
155
+ }).optional()
156
+ });
140
157
  export function formChangesMessageData(schema) {
141
158
  return formMessageDataBase.append({
142
159
  changes: Joi.object().keys({
@@ -212,6 +229,9 @@ export const messageSchema = Joi.object().keys({
212
229
  }, {
213
230
  is: Joi.string().trim().valid(AuditEventMessageType.AUTHENTICATION_LOGIN, AuditEventMessageType.AUTHENTICATION_LOGOUT_MANUAL, AuditEventMessageType.AUTHENTICATION_LOGOUT_AUTO, AuditEventMessageType.AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE),
214
231
  then: authenticationMessageData
232
+ }, {
233
+ is: Joi.string().trim().valid(AuditEventMessageType.IDENTITY_SIGN_IN_SUCCESSFUL, AuditEventMessageType.IDENTITY_SIGN_OUT, AuditEventMessageType.IDENTITY_REGISTRATION, AuditEventMessageType.IDENTITY_TOO_MANY_OTPS_REQUESTED, AuditEventMessageType.IDENTITY_INCORRECT_CODE_ENTERED, AuditEventMessageType.IDENTITY_INCORRECT_CODE_LOCKOUT, AuditEventMessageType.IDENTITY_ACCOUNT_DELETION, AuditEventMessageType.IDENTITY_EMAIL_ADDRESS_UPDATED, AuditEventMessageType.IDENTITY_PHONE_NUMBER_UPDATED),
234
+ then: identityMessageData
215
235
  }, {
216
236
  is: Joi.string().trim().valid(AuditEventMessageType.FORM_FILE_DOWNLOAD_SUCCESS, AuditEventMessageType.FORM_FILE_DOWNLOAD_FAILURE),
217
237
  then: formFileDownloadedMessageData
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Joi","AuditEventMessageCategory","AuditEventMessageSchemaVersion","AuditEventMessageSource","AuditEventMessageType","FormDefinitionRequestType","emailAddressNoUnicodeSchema","contactSchema","emailResponseTimeSchema","idSchema","notificationEmailAddressSchema","offlineSchema","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","formOutputMessageData","emailAddress","audience","trim","valid","version","condition","allow","formOutputChangesMessageData","added","array","items","updated","previous","new","removed","or","formUpdatedMessageData","requestType","Object","values","s3Meta","outputChanges","formsBackupRequestedMessageData","totalForms","number","integer","min","durationMs","formsSecretDeletedMessageData","secretName","formsSecretSavedMessageData","dlqActionMessageData","action","messageId","beforeJson","afterJson","formTitleChanges","formOrganisationChanges","formTeamNameChanges","formTeamEmailChanges","formSupportContactChanges","contact","formSupportPhoneChanges","phone","formSupportOnlineChanges","url","text","formSupportEmailChanges","address","responseTime","formPrivacyNoticeChanges","privacyNoticeType","privacyNoticeText","when","is","then","otherwise","privacyNoticeUrl","formTermsAndConditionsChanges","termsAndConditionsAgreed","formNotificationEmailChanges","notificationEmail","formSubmissionGuidanceChanges","submissionGuidance","formUploadedChanges","value","formOfflineChanges","offline","entitlementMessageData","userId","displayName","email","roles","formFileDownloadedMessageData","fileLink","excelGenerationMessageData","formName","authenticationMessageData","auditUserSchema","id","formChangesMessageData","schema","changes","messageSchema","schemaVersion","category","source","type","entityId","traceId","createdAt","date","createdBy","data","switch","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","FORM_OFFLINE_UPDATED","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 FormOfflineChanges,\n type FormOfflineUpdatedMessageData,\n type FormOrganisationChanges,\n type FormOrganisationUpdatedMessageData,\n type FormOutputChanges,\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 { type Output } from '~/src/form/form-definition/types.js'\nimport { emailAddressNoUnicodeSchema } from '~/src/form/form-editor/index.js'\nimport {\n contactSchema,\n emailResponseTimeSchema,\n idSchema,\n notificationEmailAddressSchema,\n offlineSchema,\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\n/**\n * Stands apart from the definition's own output schema, which resolves a\n * condition against the sibling `conditions` array - a lookup that has no\n * meaning on an audit message carrying the output on its own.\n */\nexport const formOutputMessageData = Joi.object<Output>()\n .keys({\n emailAddress: emailAddressNoUnicodeSchema\n .required()\n .description('Email address the submission is sent to'),\n audience: Joi.string()\n .trim()\n .valid('human', 'machine')\n .required()\n .description(\n 'Whether the submission is sent human readable or machine processable'\n ),\n version: Joi.string()\n .trim()\n .required()\n .description('Version identifier of the output format'),\n condition: Joi.string()\n .trim()\n .allow('')\n .optional()\n .description(\n 'Id of the condition determining whether the submission is sent to this address'\n )\n })\n .description('A submission email target as recorded on an audit event')\n\nexport const formOutputChangesMessageData = Joi.object<FormOutputChanges>()\n .keys({\n added: Joi.array().items(formOutputMessageData).optional(),\n updated: Joi.array()\n .items(\n Joi.object<ChangesMessageData<Output>>().keys({\n previous: formOutputMessageData.required(),\n new: formOutputMessageData.required()\n })\n )\n .optional(),\n removed: Joi.array().items(formOutputMessageData).optional()\n })\n .or('added', 'updated', 'removed')\n .description(\n \"Changes an update made to the form's submission email targets (outputs)\"\n )\n\nexport const formUpdatedMessageData = formMessageDataBase\n .append<FormUpdatedMessageData>({\n requestType: Joi.string()\n .valid(...Object.values(FormDefinitionRequestType))\n .required(),\n s3Meta: formDefinitionS3Meta.optional(),\n outputChanges: formOutputChangesMessageData.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()\n .valid('redrive', 'delete', 'modify-and-resubmit')\n .required(),\n messageId: Joi.string().optional(),\n beforeJson: Joi.string().optional(),\n afterJson: 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 formOfflineChanges = Joi.object<FormOfflineChanges>()\n .keys({\n offline: offlineSchema\n })\n .required()\n .description('Changes schema for FORM_OFFLINE_UPDATED 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 is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_OFFLINE_UPDATED),\n then: formChangesMessageData<\n FormOfflineChanges,\n FormOfflineUpdatedMessageData\n >(formOfflineChanges)\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;AAmD3B,SAASC,2BAA2B;AACpC,SACEC,aAAa,EACbC,uBAAuB,EACvBC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GjL,GAAG,CAAC0B,MAAM,CAAa,CAAC,CAC/Cc,IAAI,CAAC;EACJ0I,OAAO,EAAEjD;AACX,CAAC,CAAC,CACDjG,WAAW,CAAC,6BAA6B,CAAC;AAE7C,OAAO,MAAMmJ,WAAW,GAAGlD,aAAa,CACrC/F,MAAM,CAAc;EACnB2F,EAAE,EAAEpH,QAAQ;EACZsE,SAAS,EAAE/E,GAAG,CAAC0C,MAAM,CAAC,CAAC,CAAC0I,IAAI,CAAC,CAAC,CAACrJ,QAAQ,CAAC,CAAC;EACzCuG,QAAQ,EAAEtI,GAAG,CAAC0C,MAAM,CAAC,CAAC,CAACX,QAAQ,CAAC,CAAC;EACjCsJ,eAAe,EAAErL,GAAG,CAACyI,IAAI,CAAC,CAAC,CAAC1G,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","offlineSchema","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","formOutputMessageData","emailAddress","audience","trim","valid","version","condition","allow","formOutputChangesMessageData","added","array","items","updated","previous","new","removed","or","formUpdatedMessageData","requestType","Object","values","s3Meta","outputChanges","formsBackupRequestedMessageData","totalForms","number","integer","min","durationMs","formsSecretDeletedMessageData","secretName","formsSecretSavedMessageData","dlqActionMessageData","action","messageId","beforeJson","afterJson","formTitleChanges","formOrganisationChanges","formTeamNameChanges","formTeamEmailChanges","formSupportContactChanges","contact","formSupportPhoneChanges","phone","formSupportOnlineChanges","url","text","formSupportEmailChanges","address","responseTime","formPrivacyNoticeChanges","privacyNoticeType","privacyNoticeText","when","is","then","otherwise","privacyNoticeUrl","formTermsAndConditionsChanges","termsAndConditionsAgreed","formNotificationEmailChanges","notificationEmail","formSubmissionGuidanceChanges","submissionGuidance","formUploadedChanges","value","formOfflineChanges","offline","entitlementMessageData","userId","displayName","email","roles","formFileDownloadedMessageData","fileLink","excelGenerationMessageData","formName","authenticationMessageData","auditUserSchema","id","identityMessageData","accountId","purpose","uid","changed","old","formChangesMessageData","schema","changes","messageSchema","schemaVersion","category","source","type","entityId","traceId","createdAt","date","createdBy","data","switch","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","IDENTITY_SIGN_IN_SUCCESSFUL","IDENTITY_SIGN_OUT","IDENTITY_REGISTRATION","IDENTITY_TOO_MANY_OTPS_REQUESTED","IDENTITY_INCORRECT_CODE_ENTERED","IDENTITY_INCORRECT_CODE_LOCKOUT","IDENTITY_ACCOUNT_DELETION","IDENTITY_EMAIL_ADDRESS_UPDATED","IDENTITY_PHONE_NUMBER_UPDATED","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","FORM_OFFLINE_UPDATED","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 FormOfflineChanges,\n type FormOfflineUpdatedMessageData,\n type FormOrganisationChanges,\n type FormOrganisationUpdatedMessageData,\n type FormOutputChanges,\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 type IdentityMessageData\n} from '~/src/form/form-audit/types.js'\nimport { type Output } from '~/src/form/form-definition/types.js'\nimport { emailAddressNoUnicodeSchema } from '~/src/form/form-editor/index.js'\nimport {\n contactSchema,\n emailResponseTimeSchema,\n idSchema,\n notificationEmailAddressSchema,\n offlineSchema,\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\n/**\n * Stands apart from the definition's own output schema, which resolves a\n * condition against the sibling `conditions` array - a lookup that has no\n * meaning on an audit message carrying the output on its own.\n */\nexport const formOutputMessageData = Joi.object<Output>()\n .keys({\n emailAddress: emailAddressNoUnicodeSchema\n .required()\n .description('Email address the submission is sent to'),\n audience: Joi.string()\n .trim()\n .valid('human', 'machine')\n .required()\n .description(\n 'Whether the submission is sent human readable or machine processable'\n ),\n version: Joi.string()\n .trim()\n .required()\n .description('Version identifier of the output format'),\n condition: Joi.string()\n .trim()\n .allow('')\n .optional()\n .description(\n 'Id of the condition determining whether the submission is sent to this address'\n )\n })\n .description('A submission email target as recorded on an audit event')\n\nexport const formOutputChangesMessageData = Joi.object<FormOutputChanges>()\n .keys({\n added: Joi.array().items(formOutputMessageData).optional(),\n updated: Joi.array()\n .items(\n Joi.object<ChangesMessageData<Output>>().keys({\n previous: formOutputMessageData.required(),\n new: formOutputMessageData.required()\n })\n )\n .optional(),\n removed: Joi.array().items(formOutputMessageData).optional()\n })\n .or('added', 'updated', 'removed')\n .description(\n \"Changes an update made to the form's submission email targets (outputs)\"\n )\n\nexport const formUpdatedMessageData = formMessageDataBase\n .append<FormUpdatedMessageData>({\n requestType: Joi.string()\n .valid(...Object.values(FormDefinitionRequestType))\n .required(),\n s3Meta: formDefinitionS3Meta.optional(),\n outputChanges: formOutputChangesMessageData.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()\n .valid('redrive', 'delete', 'modify-and-resubmit')\n .required(),\n messageId: Joi.string().optional(),\n beforeJson: Joi.string().optional(),\n afterJson: 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 formOfflineChanges = Joi.object<FormOfflineChanges>()\n .keys({\n offline: offlineSchema\n })\n .required()\n .description('Changes schema for FORM_OFFLINE_UPDATED 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 const identityMessageData = Joi.object<IdentityMessageData>().keys({\n // accountId may not always be available\n accountId: Joi.string().optional(),\n // Email address associated with the identity, if any, or the target for an OTP\n email: Joi.string().optional(),\n // Phone number associated with the identity, if any, or the target for an OTP\n phone: Joi.string().optional(),\n // Purpose of the identity interaction, if any\n purpose: Joi.string().optional(),\n // Unique interaction id\n uid: Joi.string().optional(),\n // Changed fields in the identity, if any have changed\n changed: Joi.object({\n old: Joi.string().required(),\n new: Joi.string().required()\n }).optional()\n})\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.IDENTITY_SIGN_IN_SUCCESSFUL,\n AuditEventMessageType.IDENTITY_SIGN_OUT,\n AuditEventMessageType.IDENTITY_REGISTRATION,\n AuditEventMessageType.IDENTITY_TOO_MANY_OTPS_REQUESTED,\n AuditEventMessageType.IDENTITY_INCORRECT_CODE_ENTERED,\n AuditEventMessageType.IDENTITY_INCORRECT_CODE_LOCKOUT,\n AuditEventMessageType.IDENTITY_ACCOUNT_DELETION,\n AuditEventMessageType.IDENTITY_EMAIL_ADDRESS_UPDATED,\n AuditEventMessageType.IDENTITY_PHONE_NUMBER_UPDATED\n ),\n then: identityMessageData\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 is: Joi.string()\n .trim()\n .valid(AuditEventMessageType.FORM_OFFLINE_UPDATED),\n then: formChangesMessageData<\n FormOfflineChanges,\n FormOfflineUpdatedMessageData\n >(formOfflineChanges)\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;AAoD3B,SAASC,2BAA2B;AACpC,SACEC,aAAa,EACbC,uBAAuB,EACvBC,QAAQ,EACRC,8BAA8B,EAC9BC,aAAa,EACbC,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,GAAGzB,GAAG,CAAC0B,MAAM,CAAsB;EACjEC,MAAM,EAAElB,QAAQ;EAChBmB,IAAI,EAAET,UAAU;EAChBU,OAAO,EAAE7B,GAAG,CAAC0B,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,GAAGvC,GAAG,CAAC0B,MAAM,CAAuB,CAAC,CACnEc,IAAI,CAAC;EACJC,MAAM,EAAEzC,GAAG,CAAC0C,MAAM,CAAC,CAAC,CAACX,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B,CAAC,CACF;IACDV,SAAS,EAAEtG,GAAG,CAAC8L,SAAS,CAAC;EAC3B,CAAC,CAAC,CAAC9J,WAAW,CAAC,uCAAuC,CAAC;EACvD+J,gBAAgB,EAAE/L,GAAG,CAAC+I,IAAI,CAAC,CAAC,CACzBhH,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,8CAA8C;AAC/D,CAAC,CAAC,CACDD,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,oDAAoD,CAAC;AAEpE,OAAO,MAAMgK,UAAU,GAAGhM,GAAG,CAAC0B,MAAM,CAAa,CAAC,CAC/Cc,IAAI,CAAC;EACJyJ,OAAO,EAAE1D;AACX,CAAC,CAAC,CACDvG,WAAW,CAAC,6BAA6B,CAAC;AAE7C,OAAO,MAAMkK,WAAW,GAAG3D,aAAa,CACrCrG,MAAM,CAAc;EACnB2F,EAAE,EAAEpH,QAAQ;EACZsE,SAAS,EAAE/E,GAAG,CAAC0C,MAAM,CAAC,CAAC,CAACyJ,IAAI,CAAC,CAAC,CAACpK,QAAQ,CAAC,CAAC;EACzC6G,QAAQ,EAAE5I,GAAG,CAAC0C,MAAM,CAAC,CAAC,CAACX,QAAQ,CAAC,CAAC;EACjCqK,eAAe,EAAEpM,GAAG,CAAC+I,IAAI,CAAC,CAAC,CAAChH,QAAQ,CAAC;AACvC,CAAC,CAAC,CACDC,WAAW,CAAC,wCAAwC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-audit/types.ts"],"sourcesContent":["import {\n type AuditEventMessageCategory,\n type AuditEventMessageSchemaVersion,\n type AuditEventMessageSource,\n type AuditEventMessageType,\n type FormDefinitionRequestType\n} from '~/src/form/form-audit/enums.js'\nimport { type Output } from '~/src/form/form-definition/types.js'\nimport { type FormMetadataContact } from '~/src/form/form-metadata/types.js'\n\nexport interface FormMessageDataBase {\n formId: string\n slug: string\n payload?: unknown\n}\n\nexport interface ChangesMessageData<T> {\n previous: T\n new: T\n}\n\nexport interface FormCreatedMessageData extends FormMessageDataBase {\n title: string\n organisation: string\n teamName: string\n teamEmail: string\n}\n\nexport interface FormTitleChanges {\n title: string\n}\n\nexport interface FormOrganisationChanges {\n organisation: string\n}\n\nexport interface FormTeamNameChanges {\n teamName: string\n}\n\nexport interface FormTeamEmailChanges {\n teamEmail: string\n}\n\nexport interface FormSupportContactChanges {\n contact?: FormMetadataContact\n}\n\nexport interface FormSupportPhoneChanges {\n phone?: string\n}\n\nexport interface FormSupportEmailChanges {\n address?: string\n responseTime?: string\n}\n\nexport interface FormSupportOnlineChanges {\n url?: string\n text?: string\n}\n\nexport interface FormPrivacyNoticeChanges {\n privacyNoticeType?: string\n privacyNoticeText?: string\n privacyNoticeUrl?: string\n}\n\nexport interface FormTermsAndConditionsChanges {\n termsAndConditionsAgreed?: boolean\n}\n\nexport interface FormNotificationEmailChanges {\n notificationEmail?: string\n}\n\nexport interface FormSubmissionGuidanceChanges {\n submissionGuidance?: string\n}\n\nexport interface FormUploadedChanges {\n value: string\n}\n\nexport interface FormOfflineChanges {\n offline: boolean\n}\n\nexport interface FormTitleUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormTitleChanges>\n}\n\nexport interface FormOrganisationUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormOrganisationChanges>\n}\n\nexport interface FormTeamNameUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormTeamNameChanges>\n}\n\nexport interface FormTeamEmailUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormTeamEmailChanges>\n}\n\nexport interface FormSupportContactUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSupportContactChanges>\n}\n\nexport interface FormSupportPhoneUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSupportPhoneChanges>\n}\n\nexport interface FormSupportEmailUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSupportEmailChanges>\n}\n\nexport interface FormSupportOnlineUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSupportOnlineChanges>\n}\n\nexport interface FormPrivacyNoticeUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormPrivacyNoticeChanges>\n}\n\nexport interface FormTermsAndConditionsAgreedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormTermsAndConditionsChanges>\n}\n\nexport interface FormNotificationEmailUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormNotificationEmailChanges>\n}\n\nexport interface FormSubmissionGuidanceUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSubmissionGuidanceChanges>\n}\n\nexport interface FormUploadedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormUploadedChanges>\n}\n\nexport interface FormOfflineUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormOfflineChanges>\n}\n\nexport interface FormFileDownloadedMessageData {\n fileId: string\n filename: string\n fileLink: string\n}\n\nexport interface ExcelGenerationMessageData {\n formId: string\n formName: string\n notificationEmail: string\n}\n\nexport interface FormSecretBaseMessageData extends FormMessageDataBase {\n formId: string\n slug: string\n secretName: string\n}\n\nexport interface FormDefinitionS3Meta {\n fileId: string\n filename: string\n s3Key: string\n}\n\n/**\n * What a single form update did to the form's submission email targets (the\n * `outputs` on the definition, surfaced to authors as \"email actions\").\n *\n * A `REPLACE_DRAFT` update carries the whole definition, so the audit message\n * would otherwise say nothing about which email address was added, amended or\n * removed. Collections that are empty are omitted, and the object as a whole is\n * absent from an update that left the outputs untouched.\n *\n * Validated by `formOutputChangesMessageData`.\n */\nexport interface FormOutputChanges {\n /**\n * Email targets the update introduced\n */\n added?: Output[]\n\n /**\n * Email targets the update amended, with the values either side of the change\n */\n updated?: ChangesMessageData<Output>[]\n\n /**\n * Email targets the update took away - either deleted directly by the author,\n * or removed as a consequence of deleting the condition they depended on\n */\n removed?: Output[]\n}\n\nexport interface FormUpdatedMessageData extends FormMessageDataBase {\n requestType: FormDefinitionRequestType\n s3Meta?: FormDefinitionS3Meta\n\n /**\n * What this update did to the form's submission email targets. Absent when\n * the update did not touch them.\n *\n * A `DELETE_CONDITION` update reports the outputs that went with the\n * condition, so the removal is recorded against the action that caused it\n * rather than being left to be inferred from a neighbouring event.\n */\n outputChanges?: FormOutputChanges\n}\n\nexport type FormMessageChangesData =\n | FormTitleUpdatedMessageData\n | FormOrganisationUpdatedMessageData\n | FormTeamNameUpdatedMessageData\n | FormTeamEmailUpdatedMessageData\n | FormSupportContactUpdatedMessageData\n | FormSupportPhoneUpdatedMessageData\n | FormSupportEmailUpdatedMessageData\n | FormSupportOnlineUpdatedMessageData\n | FormPrivacyNoticeUpdatedMessageData\n | FormTermsAndConditionsAgreedMessageData\n | FormNotificationEmailUpdatedMessageData\n | FormSubmissionGuidanceUpdatedMessageData\n | FormUploadedMessageData\n | FormOfflineUpdatedMessageData\n\nexport type FormMessageActivitiesData =\n | FormCreatedMessageData\n | FormMessageDataBase\n | FormFileDownloadedMessageData\n\nexport interface EntitlementMessageData {\n userId: string\n displayName: string\n email: string\n roles: string[]\n}\n\nexport interface AuthenticationMessageData {\n userId: string\n displayName: string\n}\n\nexport interface AuditUser {\n id: string\n displayName: string\n}\n\nexport interface FormsBackupRequestedMessageData {\n totalForms: number\n durationMs: number\n}\n\nexport interface DlqActionMessageData {\n action: string\n messageId?: string\n beforeJson?: string\n afterJson?: string\n}\n\nexport type MessageData =\n | FormMessageChangesData\n | FormMessageActivitiesData\n | FormUpdatedMessageData\n | EntitlementMessageData\n | AuthenticationMessageData\n | ExcelGenerationMessageData\n | FormFileDownloadedMessageData\n | FormsBackupRequestedMessageData\n | FormSecretBaseMessageData\n | DlqActionMessageData\n\nexport interface MessageBase {\n schemaVersion: AuditEventMessageSchemaVersion\n category: AuditEventMessageCategory\n source: AuditEventMessageSource\n type: AuditEventMessageType\n entityId: string\n traceId?: string\n createdAt: Date\n createdBy: AuditUser\n data?: MessageData\n messageCreatedAt: Date\n}\n\nexport interface ManagerMessageBase extends MessageBase {\n source: AuditEventMessageSource.FORMS_MANAGER\n}\nexport interface DesignerMessageBase extends MessageBase {\n source: AuditEventMessageSource.FORMS_DESIGNER\n}\n\nexport interface EntitlementMessageBase extends MessageBase {\n source: AuditEventMessageSource.ENTITLEMENT\n}\n\nexport interface AuthenticationMessageBase extends MessageBase {\n source: AuditEventMessageSource.AUTHENTICATION\n}\n\nexport interface FormCreatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_CREATED\n data: FormCreatedMessageData\n}\n\nexport interface FormTitleUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_TITLE_UPDATED\n data: FormTitleUpdatedMessageData\n}\n\nexport interface FormOrganisationUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_ORGANISATION_UPDATED\n data: FormOrganisationUpdatedMessageData\n}\n\nexport interface FormTeamNameUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_TEAM_NAME_UPDATED\n data: FormTeamNameUpdatedMessageData\n}\n\nexport interface FormTeamEmailUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_TEAM_EMAIL_UPDATED\n data: FormTeamEmailUpdatedMessageData\n}\n\nexport interface FormSupportContactUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUPPORT_CONTACT_UPDATED\n data: FormSupportContactUpdatedMessageData\n}\n\nexport interface FormSupportPhoneUpdatedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUPPORT_PHONE_UPDATED\n data: FormSupportPhoneUpdatedMessageData\n}\n\nexport interface FormSupportEmailUpdatedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUPPORT_EMAIL_UPDATED\n data: FormSupportEmailUpdatedMessageData\n}\n\nexport interface FormSupportOnlineUpdatedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUPPORT_ONLINE_UPDATED\n data: FormSupportOnlineUpdatedMessageData\n}\n\nexport interface FormPrivacyNoticeUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_PRIVACY_NOTICE_UPDATED\n source: AuditEventMessageSource.FORMS_MANAGER\n data: FormPrivacyNoticeUpdatedMessageData\n}\n\nexport interface FormTermsAndConditionsAgreedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_TERMS_AND_CONDITIONS_AGREED\n source: AuditEventMessageSource.FORMS_MANAGER\n data: FormTermsAndConditionsAgreedMessageData\n}\n\nexport interface FormNotificationEmailUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_NOTIFICATION_EMAIL_UPDATED\n source: AuditEventMessageSource.FORMS_MANAGER\n data: FormNotificationEmailUpdatedMessageData\n}\n\nexport interface FormSubmissionGuidanceUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUBMISSION_GUIDANCE_UPDATED\n source: AuditEventMessageSource.FORMS_MANAGER\n data: FormSubmissionGuidanceUpdatedMessageData\n}\n\nexport interface FormUploadedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_JSON_UPLOADED\n data: FormUploadedMessageData\n}\n\nexport interface FormDownloadedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_JSON_DOWNLOADED\n data: FormMessageDataBase\n}\n\nexport interface FormFileDownloadSuccessMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_FILE_DOWNLOAD_SUCCESS\n data: FormFileDownloadedMessageData\n}\n\nexport interface FormFileDownloadFailureMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_FILE_DOWNLOAD_FAILURE\n data: FormFileDownloadedMessageData\n}\n\nexport interface FormDraftCreatedFromLiveMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_DRAFT_CREATED_FROM_LIVE\n}\n\nexport interface FormLiveCreatedFromDraftMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_LIVE_CREATED_FROM_DRAFT\n}\n\nexport interface FormDraftDeletedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_DRAFT_DELETED\n}\n\nexport interface FormMigratedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_MIGRATED\n}\n\nexport interface FormUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_UPDATED\n data: FormUpdatedMessageData\n}\n\nexport interface FormOfflineUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_OFFLINE_UPDATED\n data: FormOfflineUpdatedMessageData\n}\n\nexport interface EntitlementCreatedMessage extends EntitlementMessageBase {\n category: AuditEventMessageCategory.ENTITLEMENT\n type: AuditEventMessageType.ENTITLEMENT_CREATED\n data: EntitlementMessageData\n}\n\nexport interface EntitlementUpdatedMessage extends EntitlementMessageBase {\n category: AuditEventMessageCategory.ENTITLEMENT\n type: AuditEventMessageType.ENTITLEMENT_UPDATED\n data: EntitlementMessageData\n}\n\nexport interface EntitlementDeletedMessage extends EntitlementMessageBase {\n category: AuditEventMessageCategory.ENTITLEMENT\n type: AuditEventMessageType.ENTITLEMENT_DELETED\n data: EntitlementMessageData\n}\n\nexport interface AuthenticationLoginMessage extends AuthenticationMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.AUTHENTICATION_LOGIN\n data: AuthenticationMessageData\n}\n\nexport interface AuthenticationLogoutManualMessage extends AuthenticationMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.AUTHENTICATION_LOGOUT_MANUAL\n data: AuthenticationMessageData\n}\n\nexport interface AuthenticationLogoutAutoMessage extends AuthenticationMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.AUTHENTICATION_LOGOUT_AUTO\n data: AuthenticationMessageData\n}\n\nexport interface AuthenticationLogoutDifferentDeviceMessage extends AuthenticationMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE\n data: AuthenticationMessageData\n}\n\nexport interface FormSubmissionExcelRequestedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUBMISSION_EXCEL_REQUESTED\n data: ExcelGenerationMessageData\n}\n\nexport interface FormCsatExcelRequestedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_CSAT_EXCEL_REQUESTED\n data: ExcelGenerationMessageData\n}\n\nexport interface PlatformCsatExcelRequestedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.PLATFORM_CSAT_EXCEL_REQUESTED\n data: ExcelGenerationMessageData\n}\n\nexport interface PlatformMetricsDownloadRequestedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.PLATFORM_METRICS_DOWNLOAD_REQUESTED\n}\n\nexport interface FormsBackupRequestedMessage extends DesignerMessageBase {\n type: AuditEventMessageType.FORMS_BACKUP_REQUESTED\n data: FormsBackupRequestedMessageData\n}\n\nexport interface DlqActionMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.OPERATIONS\n type: AuditEventMessageType.DLQ_ACTION\n data: DlqActionMessageData\n}\n\nexport interface FormSecretDeletedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SECRET_DELETED\n data: FormSecretBaseMessageData\n}\n\nexport interface FormSecretSavedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SECRET_SAVED\n data: FormSecretBaseMessageData\n}\n\nexport type AuditMessage =\n | FormCreatedMessage\n | FormTitleUpdatedMessage\n | FormOrganisationUpdatedMessage\n | FormTeamNameUpdatedMessage\n | FormTeamEmailUpdatedMessage\n | FormSupportContactUpdatedMessage\n | FormSupportPhoneUpdatedMessage\n | FormSupportEmailUpdatedMessage\n | FormSupportOnlineUpdatedMessage\n | FormPrivacyNoticeUpdatedMessage\n | FormTermsAndConditionsAgreedMessage\n | FormNotificationEmailUpdatedMessage\n | FormSubmissionGuidanceUpdatedMessage\n | FormUploadedMessage\n | FormDownloadedMessage\n | FormFileDownloadSuccessMessage\n | FormFileDownloadFailureMessage\n | FormDraftCreatedFromLiveMessage\n | FormLiveCreatedFromDraftMessage\n | FormDraftDeletedMessage\n | FormMigratedMessage\n | FormUpdatedMessage\n | FormOfflineUpdatedMessage\n | EntitlementCreatedMessage\n | EntitlementUpdatedMessage\n | EntitlementDeletedMessage\n | AuthenticationLoginMessage\n | AuthenticationLogoutManualMessage\n | AuthenticationLogoutAutoMessage\n | AuthenticationLogoutDifferentDeviceMessage\n | FormSubmissionExcelRequestedMessage\n | FormCsatExcelRequestedMessage\n | PlatformCsatExcelRequestedMessage\n | PlatformMetricsDownloadRequestedMessage\n | FormsBackupRequestedMessage\n | FormSecretDeletedMessage\n | FormSecretSavedMessage\n | DlqActionMessage\n\nexport interface AuditEvent {\n message: AuditMessage\n}\n\nexport interface AuditMetaBase {\n messageId: string\n recordCreatedAt: Date\n}\n\nexport interface AuditInputMeta extends AuditMetaBase {\n id: string\n}\n\nexport type AuditRecordInput = AuditMessage & AuditMetaBase\n\nexport type AuditRecord = AuditMessage & AuditInputMeta\n\nexport interface MessageBody {\n Message: string\n}\n\n/**\n * Consolidated audit record that represents multiple grouped events.\n * Combines AuditRecord with consolidation metadata.\n */\nexport type ConsolidatedAuditRecord = AuditRecord & {\n /** Number of events consolidated into this record */\n consolidatedCount: number\n /** Timestamp of the earliest event in the group */\n consolidatedFrom: Date\n /** Timestamp of the latest event in the group */\n consolidatedTo: Date\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-audit/types.ts"],"sourcesContent":["import {\n type AuditEventMessageCategory,\n type AuditEventMessageSchemaVersion,\n type AuditEventMessageSource,\n type AuditEventMessageType,\n type FormDefinitionRequestType\n} from '~/src/form/form-audit/enums.js'\nimport { type Output } from '~/src/form/form-definition/types.js'\nimport { type FormMetadataContact } from '~/src/form/form-metadata/types.js'\n\nexport interface FormMessageDataBase {\n formId: string\n slug: string\n payload?: unknown\n}\n\nexport interface ChangesMessageData<T> {\n previous: T\n new: T\n}\n\nexport interface FormCreatedMessageData extends FormMessageDataBase {\n title: string\n organisation: string\n teamName: string\n teamEmail: string\n}\n\nexport interface FormTitleChanges {\n title: string\n}\n\nexport interface FormOrganisationChanges {\n organisation: string\n}\n\nexport interface FormTeamNameChanges {\n teamName: string\n}\n\nexport interface FormTeamEmailChanges {\n teamEmail: string\n}\n\nexport interface FormSupportContactChanges {\n contact?: FormMetadataContact\n}\n\nexport interface FormSupportPhoneChanges {\n phone?: string\n}\n\nexport interface FormSupportEmailChanges {\n address?: string\n responseTime?: string\n}\n\nexport interface FormSupportOnlineChanges {\n url?: string\n text?: string\n}\n\nexport interface FormPrivacyNoticeChanges {\n privacyNoticeType?: string\n privacyNoticeText?: string\n privacyNoticeUrl?: string\n}\n\nexport interface FormTermsAndConditionsChanges {\n termsAndConditionsAgreed?: boolean\n}\n\nexport interface FormNotificationEmailChanges {\n notificationEmail?: string\n}\n\nexport interface FormSubmissionGuidanceChanges {\n submissionGuidance?: string\n}\n\nexport interface FormUploadedChanges {\n value: string\n}\n\nexport interface FormOfflineChanges {\n offline: boolean\n}\n\nexport interface FormTitleUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormTitleChanges>\n}\n\nexport interface FormOrganisationUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormOrganisationChanges>\n}\n\nexport interface FormTeamNameUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormTeamNameChanges>\n}\n\nexport interface FormTeamEmailUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormTeamEmailChanges>\n}\n\nexport interface FormSupportContactUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSupportContactChanges>\n}\n\nexport interface FormSupportPhoneUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSupportPhoneChanges>\n}\n\nexport interface FormSupportEmailUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSupportEmailChanges>\n}\n\nexport interface FormSupportOnlineUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSupportOnlineChanges>\n}\n\nexport interface FormPrivacyNoticeUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormPrivacyNoticeChanges>\n}\n\nexport interface FormTermsAndConditionsAgreedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormTermsAndConditionsChanges>\n}\n\nexport interface FormNotificationEmailUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormNotificationEmailChanges>\n}\n\nexport interface FormSubmissionGuidanceUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormSubmissionGuidanceChanges>\n}\n\nexport interface FormUploadedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormUploadedChanges>\n}\n\nexport interface FormOfflineUpdatedMessageData extends FormMessageDataBase {\n changes: ChangesMessageData<FormOfflineChanges>\n}\n\nexport interface FormFileDownloadedMessageData {\n fileId: string\n filename: string\n fileLink: string\n}\n\nexport interface ExcelGenerationMessageData {\n formId: string\n formName: string\n notificationEmail: string\n}\n\nexport interface FormSecretBaseMessageData extends FormMessageDataBase {\n formId: string\n slug: string\n secretName: string\n}\n\nexport interface FormDefinitionS3Meta {\n fileId: string\n filename: string\n s3Key: string\n}\n\n/**\n * What a single form update did to the form's submission email targets (the\n * `outputs` on the definition, surfaced to authors as \"email actions\").\n *\n * A `REPLACE_DRAFT` update carries the whole definition, so the audit message\n * would otherwise say nothing about which email address was added, amended or\n * removed. Collections that are empty are omitted, and the object as a whole is\n * absent from an update that left the outputs untouched.\n *\n * Validated by `formOutputChangesMessageData`.\n */\nexport interface FormOutputChanges {\n /**\n * Email targets the update introduced\n */\n added?: Output[]\n\n /**\n * Email targets the update amended, with the values either side of the change\n */\n updated?: ChangesMessageData<Output>[]\n\n /**\n * Email targets the update took away - either deleted directly by the author,\n * or removed as a consequence of deleting the condition they depended on\n */\n removed?: Output[]\n}\n\nexport interface FormUpdatedMessageData extends FormMessageDataBase {\n requestType: FormDefinitionRequestType\n s3Meta?: FormDefinitionS3Meta\n\n /**\n * What this update did to the form's submission email targets. Absent when\n * the update did not touch them.\n *\n * A `DELETE_CONDITION` update reports the outputs that went with the\n * condition, so the removal is recorded against the action that caused it\n * rather than being left to be inferred from a neighbouring event.\n */\n outputChanges?: FormOutputChanges\n}\n\nexport type FormMessageChangesData =\n | FormTitleUpdatedMessageData\n | FormOrganisationUpdatedMessageData\n | FormTeamNameUpdatedMessageData\n | FormTeamEmailUpdatedMessageData\n | FormSupportContactUpdatedMessageData\n | FormSupportPhoneUpdatedMessageData\n | FormSupportEmailUpdatedMessageData\n | FormSupportOnlineUpdatedMessageData\n | FormPrivacyNoticeUpdatedMessageData\n | FormTermsAndConditionsAgreedMessageData\n | FormNotificationEmailUpdatedMessageData\n | FormSubmissionGuidanceUpdatedMessageData\n | FormUploadedMessageData\n | FormOfflineUpdatedMessageData\n\nexport type FormMessageActivitiesData =\n | FormCreatedMessageData\n | FormMessageDataBase\n | FormFileDownloadedMessageData\n\nexport interface EntitlementMessageData {\n userId: string\n displayName: string\n email: string\n roles: string[]\n}\n\nexport interface AuthenticationMessageData {\n userId: string\n displayName: string\n}\n\nexport interface AuditUser {\n id: string\n displayName: string\n}\n\nexport interface IdentityMessageData {\n accountId?: string\n email?: string\n phone?: string\n purpose?: string\n uid?: string\n changed?: {\n old: string\n new: string\n }\n}\n\nexport interface FormsBackupRequestedMessageData {\n totalForms: number\n durationMs: number\n}\n\nexport interface DlqActionMessageData {\n action: string\n messageId?: string\n beforeJson?: string\n afterJson?: string\n}\n\nexport type MessageData =\n | FormMessageChangesData\n | FormMessageActivitiesData\n | FormUpdatedMessageData\n | EntitlementMessageData\n | AuthenticationMessageData\n | ExcelGenerationMessageData\n | FormFileDownloadedMessageData\n | FormsBackupRequestedMessageData\n | FormSecretBaseMessageData\n | DlqActionMessageData\n | IdentityMessageData\n\nexport interface MessageBase {\n schemaVersion: AuditEventMessageSchemaVersion\n category: AuditEventMessageCategory\n source: AuditEventMessageSource\n type: AuditEventMessageType\n entityId: string\n traceId?: string\n createdAt: Date\n createdBy: AuditUser\n data?: MessageData\n messageCreatedAt: Date\n}\n\nexport interface ManagerMessageBase extends MessageBase {\n source: AuditEventMessageSource.FORMS_MANAGER\n}\nexport interface DesignerMessageBase extends MessageBase {\n source: AuditEventMessageSource.FORMS_DESIGNER\n}\n\nexport interface EntitlementMessageBase extends MessageBase {\n source: AuditEventMessageSource.ENTITLEMENT\n}\n\nexport interface AuthenticationMessageBase extends MessageBase {\n source: AuditEventMessageSource.AUTHENTICATION\n}\n\nexport interface IdentityMessageBase extends MessageBase {\n source: AuditEventMessageSource.FORMS_IDENTITY\n}\n\nexport interface FormCreatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_CREATED\n data: FormCreatedMessageData\n}\n\nexport interface FormTitleUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_TITLE_UPDATED\n data: FormTitleUpdatedMessageData\n}\n\nexport interface FormOrganisationUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_ORGANISATION_UPDATED\n data: FormOrganisationUpdatedMessageData\n}\n\nexport interface FormTeamNameUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_TEAM_NAME_UPDATED\n data: FormTeamNameUpdatedMessageData\n}\n\nexport interface FormTeamEmailUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_TEAM_EMAIL_UPDATED\n data: FormTeamEmailUpdatedMessageData\n}\n\nexport interface FormSupportContactUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUPPORT_CONTACT_UPDATED\n data: FormSupportContactUpdatedMessageData\n}\n\nexport interface FormSupportPhoneUpdatedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUPPORT_PHONE_UPDATED\n data: FormSupportPhoneUpdatedMessageData\n}\n\nexport interface FormSupportEmailUpdatedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUPPORT_EMAIL_UPDATED\n data: FormSupportEmailUpdatedMessageData\n}\n\nexport interface FormSupportOnlineUpdatedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUPPORT_ONLINE_UPDATED\n data: FormSupportOnlineUpdatedMessageData\n}\n\nexport interface FormPrivacyNoticeUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_PRIVACY_NOTICE_UPDATED\n source: AuditEventMessageSource.FORMS_MANAGER\n data: FormPrivacyNoticeUpdatedMessageData\n}\n\nexport interface FormTermsAndConditionsAgreedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_TERMS_AND_CONDITIONS_AGREED\n source: AuditEventMessageSource.FORMS_MANAGER\n data: FormTermsAndConditionsAgreedMessageData\n}\n\nexport interface FormNotificationEmailUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_NOTIFICATION_EMAIL_UPDATED\n source: AuditEventMessageSource.FORMS_MANAGER\n data: FormNotificationEmailUpdatedMessageData\n}\n\nexport interface FormSubmissionGuidanceUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUBMISSION_GUIDANCE_UPDATED\n source: AuditEventMessageSource.FORMS_MANAGER\n data: FormSubmissionGuidanceUpdatedMessageData\n}\n\nexport interface FormUploadedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_JSON_UPLOADED\n data: FormUploadedMessageData\n}\n\nexport interface FormDownloadedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_JSON_DOWNLOADED\n data: FormMessageDataBase\n}\n\nexport interface FormFileDownloadSuccessMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_FILE_DOWNLOAD_SUCCESS\n data: FormFileDownloadedMessageData\n}\n\nexport interface FormFileDownloadFailureMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_FILE_DOWNLOAD_FAILURE\n data: FormFileDownloadedMessageData\n}\n\nexport interface FormDraftCreatedFromLiveMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_DRAFT_CREATED_FROM_LIVE\n}\n\nexport interface FormLiveCreatedFromDraftMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_LIVE_CREATED_FROM_DRAFT\n}\n\nexport interface FormDraftDeletedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_DRAFT_DELETED\n}\n\nexport interface FormMigratedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_MIGRATED\n}\n\nexport interface FormUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_UPDATED\n data: FormUpdatedMessageData\n}\n\nexport interface FormOfflineUpdatedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_OFFLINE_UPDATED\n data: FormOfflineUpdatedMessageData\n}\n\nexport interface EntitlementCreatedMessage extends EntitlementMessageBase {\n category: AuditEventMessageCategory.ENTITLEMENT\n type: AuditEventMessageType.ENTITLEMENT_CREATED\n data: EntitlementMessageData\n}\n\nexport interface EntitlementUpdatedMessage extends EntitlementMessageBase {\n category: AuditEventMessageCategory.ENTITLEMENT\n type: AuditEventMessageType.ENTITLEMENT_UPDATED\n data: EntitlementMessageData\n}\n\nexport interface EntitlementDeletedMessage extends EntitlementMessageBase {\n category: AuditEventMessageCategory.ENTITLEMENT\n type: AuditEventMessageType.ENTITLEMENT_DELETED\n data: EntitlementMessageData\n}\n\nexport interface AuthenticationLoginMessage extends AuthenticationMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.AUTHENTICATION_LOGIN\n data: AuthenticationMessageData\n}\n\nexport interface AuthenticationLogoutManualMessage extends AuthenticationMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.AUTHENTICATION_LOGOUT_MANUAL\n data: AuthenticationMessageData\n}\n\nexport interface AuthenticationLogoutAutoMessage extends AuthenticationMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.AUTHENTICATION_LOGOUT_AUTO\n data: AuthenticationMessageData\n}\n\nexport interface AuthenticationLogoutDifferentDeviceMessage extends AuthenticationMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.AUTHENTICATION_LOGOUT_DIFFERENT_DEVICE\n data: AuthenticationMessageData\n}\n\nexport interface FormSubmissionExcelRequestedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SUBMISSION_EXCEL_REQUESTED\n data: ExcelGenerationMessageData\n}\n\nexport interface FormCsatExcelRequestedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_CSAT_EXCEL_REQUESTED\n data: ExcelGenerationMessageData\n}\n\nexport interface PlatformCsatExcelRequestedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.PLATFORM_CSAT_EXCEL_REQUESTED\n data: ExcelGenerationMessageData\n}\n\nexport interface PlatformMetricsDownloadRequestedMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.PLATFORM_METRICS_DOWNLOAD_REQUESTED\n}\n\nexport interface FormsBackupRequestedMessage extends DesignerMessageBase {\n type: AuditEventMessageType.FORMS_BACKUP_REQUESTED\n data: FormsBackupRequestedMessageData\n}\n\nexport interface DlqActionMessage extends DesignerMessageBase {\n category: AuditEventMessageCategory.OPERATIONS\n type: AuditEventMessageType.DLQ_ACTION\n data: DlqActionMessageData\n}\n\nexport interface FormSecretDeletedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SECRET_DELETED\n data: FormSecretBaseMessageData\n}\n\nexport interface FormSecretSavedMessage extends ManagerMessageBase {\n category: AuditEventMessageCategory.FORM\n type: AuditEventMessageType.FORM_SECRET_SAVED\n data: FormSecretBaseMessageData\n}\n\nexport interface IdentitySignInSuccessfulMessage extends IdentityMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.IDENTITY_SIGN_IN_SUCCESSFUL\n data: IdentityMessageData\n}\n\nexport interface IdentitySignOutMessage extends IdentityMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.IDENTITY_SIGN_OUT\n data: IdentityMessageData\n}\n\nexport interface IdentityRegistrationMessage extends IdentityMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.IDENTITY_REGISTRATION\n data: IdentityMessageData\n}\n\nexport interface IdentityTooManyOtpsRequestedMessage extends IdentityMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.IDENTITY_TOO_MANY_OTPS_REQUESTED\n data: IdentityMessageData\n}\n\nexport interface IdentityIncorrectCodeEnteredMessage extends IdentityMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.IDENTITY_INCORRECT_CODE_ENTERED\n data: IdentityMessageData\n}\n\nexport interface IdentityIncorrectCodeLockoutMessage extends IdentityMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.IDENTITY_INCORRECT_CODE_LOCKOUT\n data: IdentityMessageData\n}\n\nexport interface IdentityAccountDeletionMessage extends IdentityMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.IDENTITY_ACCOUNT_DELETION\n data: IdentityMessageData\n}\n\nexport interface IdentityEmailAddressUpdatedMessage extends IdentityMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.IDENTITY_EMAIL_ADDRESS_UPDATED\n data: IdentityMessageData\n}\n\nexport interface IdentityPhoneNumberUpdatedMessage extends IdentityMessageBase {\n category: AuditEventMessageCategory.AUTHENTICATION\n type: AuditEventMessageType.IDENTITY_PHONE_NUMBER_UPDATED\n data: IdentityMessageData\n}\n\nexport type AuditMessage =\n | FormCreatedMessage\n | FormTitleUpdatedMessage\n | FormOrganisationUpdatedMessage\n | FormTeamNameUpdatedMessage\n | FormTeamEmailUpdatedMessage\n | FormSupportContactUpdatedMessage\n | FormSupportPhoneUpdatedMessage\n | FormSupportEmailUpdatedMessage\n | FormSupportOnlineUpdatedMessage\n | FormPrivacyNoticeUpdatedMessage\n | FormTermsAndConditionsAgreedMessage\n | FormNotificationEmailUpdatedMessage\n | FormSubmissionGuidanceUpdatedMessage\n | FormUploadedMessage\n | FormDownloadedMessage\n | FormFileDownloadSuccessMessage\n | FormFileDownloadFailureMessage\n | FormDraftCreatedFromLiveMessage\n | FormLiveCreatedFromDraftMessage\n | FormDraftDeletedMessage\n | FormMigratedMessage\n | FormUpdatedMessage\n | FormOfflineUpdatedMessage\n | EntitlementCreatedMessage\n | EntitlementUpdatedMessage\n | EntitlementDeletedMessage\n | AuthenticationLoginMessage\n | AuthenticationLogoutManualMessage\n | AuthenticationLogoutAutoMessage\n | AuthenticationLogoutDifferentDeviceMessage\n | FormSubmissionExcelRequestedMessage\n | FormCsatExcelRequestedMessage\n | PlatformCsatExcelRequestedMessage\n | PlatformMetricsDownloadRequestedMessage\n | FormsBackupRequestedMessage\n | FormSecretDeletedMessage\n | FormSecretSavedMessage\n | DlqActionMessage\n | IdentitySignInSuccessfulMessage\n | IdentitySignOutMessage\n | IdentityRegistrationMessage\n | IdentityTooManyOtpsRequestedMessage\n | IdentityIncorrectCodeEnteredMessage\n | IdentityIncorrectCodeLockoutMessage\n | IdentityAccountDeletionMessage\n | IdentityEmailAddressUpdatedMessage\n | IdentityPhoneNumberUpdatedMessage\n\nexport interface AuditEvent {\n message: AuditMessage\n}\n\nexport interface AuditMetaBase {\n messageId: string\n recordCreatedAt: Date\n}\n\nexport interface AuditInputMeta extends AuditMetaBase {\n id: string\n}\n\nexport type AuditRecordInput = AuditMessage & AuditMetaBase\n\nexport type AuditRecord = AuditMessage & AuditInputMeta\n\nexport interface MessageBody {\n Message: string\n}\n\n/**\n * Consolidated audit record that represents multiple grouped events.\n * Combines AuditRecord with consolidation metadata.\n */\nexport type ConsolidatedAuditRecord = AuditRecord & {\n /** Number of events consolidated into this record */\n consolidatedCount: number\n /** Timestamp of the earliest event in the group */\n consolidatedFrom: Date\n /** Timestamp of the latest event in the group */\n consolidatedTo: Date\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +1,4 @@
1
1
  export const MIN_NUMBER_OF_REPEAT_ITEMS = 1;
2
2
  export const MAX_NUMBER_OF_REPEAT_ITEMS = 200;
3
+ export const FORM_ACTION_COPY = 'copy';
3
4
  //# sourceMappingURL=constants.js.map
@@ -1 +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":[]}
1
+ {"version":3,"file":"constants.js","names":["MIN_NUMBER_OF_REPEAT_ITEMS","MAX_NUMBER_OF_REPEAT_ITEMS","FORM_ACTION_COPY"],"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\nexport const FORM_ACTION_COPY = 'copy'\n"],"mappings":"AAAA,OAAO,MAAMA,0BAA0B,GAAG,CAAC;AAC3C,OAAO,MAAMC,0BAA0B,GAAG,GAAG;AAE7C,OAAO,MAAMC,gBAAgB,GAAG,MAAM","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  import { ComponentType } from "../../components/enums.js";
2
+ import { FORM_ACTION_COPY } from "./constants.js";
2
3
  import { hasComponents } from "../../pages/helpers.js";
3
4
 
4
5
  /**
@@ -83,4 +84,33 @@ export function isFeedbackForm(definition) {
83
84
  const feedback = 'FeedbackPageController';
84
85
  return definition?.pages ? definition.pages.some(p => p.controller === feedback) : false;
85
86
  }
87
+
88
+ /**
89
+ * Checks whether the form allows answers to be reused from a previous
90
+ * submission, as set by the metadata.options.allowCopy flag. forms-model does
91
+ * not define metadata.options, so its type is checked here
92
+ * @param {FormDefinition} formDefinition
93
+ * @returns {boolean}
94
+ */
95
+ export function isAllowCopyEnabled(formDefinition) {
96
+ const options = formDefinition.metadata?.options;
97
+ return typeof options === 'object' && options !== null && 'allowCopy' in options && options.allowCopy === true;
98
+ }
99
+
100
+ /**
101
+ * Retrieves the action details of the form submission, if any.
102
+ * @param {{ custom?: { actionName?: string, actionReferenceNumber?: string } }} messageMeta
103
+ * @param {FormDefinition} formDefinition
104
+ * @returns
105
+ */
106
+ export function getFormAction(messageMeta, formDefinition) {
107
+ // 'Copy' action
108
+ if (isAllowCopyEnabled(formDefinition) && messageMeta?.custom?.actionName === FORM_ACTION_COPY && messageMeta.custom.actionReferenceNumber) {
109
+ return {
110
+ name: FORM_ACTION_COPY,
111
+ referenceNumber: /** @type {string} */messageMeta.custom.actionReferenceNumber
112
+ };
113
+ }
114
+ return undefined;
115
+ }
86
116
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["ComponentType","hasComponents","isFormDefinition","definition","isConditionListItemRefValueData","conditionValueData","getConditionListItemIds","value","itemId","Array","isArray","getHiddenFields","pages","length","totalHiddenFields","page","hiddenFields","components","filter","comp","type","HiddenField","push","getOutputKey","output","emailAddress","trim","toLowerCase","condition","audience","version","join","isDuplicateOutput","otherOutput","isFeedbackForm","feedback","some","p","controller"],"sources":["../../../../src/form/form-definition/helpers.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport { type ConditionListItemRefValueDataV2 } from '~/src/conditions/types.js'\nimport {\n type FormDefinition,\n type Output\n} from '~/src/form/form-definition/types.js'\nimport { type ControllerType } from '~/src/pages/enums.js'\nimport { hasComponents } from '~/src/pages/helpers.js'\n\n/**\n * TypeGuard to check if something is a FormDefinition\n * @param { unknown } definition\n * @returns { definition is FormDefinition }\n */\nexport function isFormDefinition(\n definition: unknown\n): definition is FormDefinition {\n if (!definition) {\n return false\n }\n\n return (\n typeof definition === 'object' &&\n 'name' in definition &&\n 'pages' in definition &&\n 'conditions' in definition\n )\n}\n\n/**\n * TypeGuard to check if something is a ConditionListItemRefValueDataV2\n * @param { unknown } conditionValueData\n * @returns { conditionValueData is ConditionListItemRefValueDataV2 }\n */\nexport function isConditionListItemRefValueData(\n conditionValueData: unknown\n): conditionValueData is ConditionListItemRefValueDataV2 {\n if (!conditionValueData) {\n return false\n }\n\n return (\n typeof conditionValueData === 'object' &&\n 'listId' in conditionValueData &&\n 'itemId' in conditionValueData\n )\n}\n\n/**\n * Normalises a list item ref condition value to an array of item ids. `itemId`\n * is normally an array, but may be a bare string for legacy conditions saved\n * before multi-select support.\n * @param { ConditionListItemRefValueDataV2 | undefined } value\n * @returns { string[] }\n */\nexport function getConditionListItemIds(\n value: ConditionListItemRefValueDataV2 | undefined\n): string[] {\n if (!value?.itemId) {\n return []\n }\n\n return Array.isArray(value.itemId) ? value.itemId : [value.itemId]\n}\n\n/**\n * Returns an array of all hidden fields in a form\n * @param definition - form definition\n */\nexport function getHiddenFields(definition: FormDefinition) {\n if (definition.pages.length === 0) {\n return []\n }\n const totalHiddenFields = [] as ComponentDef[]\n for (const page of definition.pages) {\n const hiddenFields = hasComponents(page)\n ? page.components.filter(\n (comp) => comp.type === ComponentType.HiddenField\n )\n : []\n totalHiddenFields.push(...hiddenFields)\n }\n return totalHiddenFields\n}\n\n/**\n * Builds the key identifying a submission email target. Two outputs sharing a\n * key would send the same format of the same submission to the same inbox in\n * the same circumstances, so one of them is redundant. Addresses are compared\n * case-insensitively and a missing condition is treated as an empty one.\n * @param output - submission email target\n */\nexport function getOutputKey(output: Partial<Output>): string {\n return [\n output.emailAddress?.trim().toLowerCase() ?? '',\n output.condition?.trim() ?? '',\n output.audience ?? '',\n output.version?.trim() ?? ''\n ].join('|')\n}\n\n/**\n * Whether two submission email targets are duplicates of one another\n * @param output - submission email target\n * @param otherOutput - submission email target to compare against\n */\nexport function isDuplicateOutput(\n output: Partial<Output>,\n otherOutput: Partial<Output>\n): boolean {\n return getOutputKey(output) === getOutputKey(otherOutput)\n}\n\n/**\n * @param definition - form definition\n * @returns {boolean}\n */\nexport function isFeedbackForm(definition: FormDefinition | undefined) {\n const feedback = 'FeedbackPageController' as ControllerType\n return definition?.pages\n ? definition.pages.some((p) => p.controller === feedback)\n : false\n}\n"],"mappings":"AAAA,SAASA,aAAa;AAQtB,SAASC,aAAa;;AAEtB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,UAAmB,EACW;EAC9B,IAAI,CAACA,UAAU,EAAE;IACf,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,UAAU,KAAK,QAAQ,IAC9B,MAAM,IAAIA,UAAU,IACpB,OAAO,IAAIA,UAAU,IACrB,YAAY,IAAIA,UAAU;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAC7CC,kBAA2B,EAC4B;EACvD,IAAI,CAACA,kBAAkB,EAAE;IACvB,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,kBAAkB,KAAK,QAAQ,IACtC,QAAQ,IAAIA,kBAAkB,IAC9B,QAAQ,IAAIA,kBAAkB;AAElC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,KAAkD,EACxC;EACV,IAAI,CAACA,KAAK,EAAEC,MAAM,EAAE;IAClB,OAAO,EAAE;EACX;EAEA,OAAOC,KAAK,CAACC,OAAO,CAACH,KAAK,CAACC,MAAM,CAAC,GAAGD,KAAK,CAACC,MAAM,GAAG,CAACD,KAAK,CAACC,MAAM,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASG,eAAeA,CAACR,UAA0B,EAAE;EAC1D,IAAIA,UAAU,CAACS,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE;IACjC,OAAO,EAAE;EACX;EACA,MAAMC,iBAAiB,GAAG,EAAoB;EAC9C,KAAK,MAAMC,IAAI,IAAIZ,UAAU,CAACS,KAAK,EAAE;IACnC,MAAMI,YAAY,GAAGf,aAAa,CAACc,IAAI,CAAC,GACpCA,IAAI,CAACE,UAAU,CAACC,MAAM,CACnBC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAKpB,aAAa,CAACqB,WACxC,CAAC,GACD,EAAE;IACNP,iBAAiB,CAACQ,IAAI,CAAC,GAAGN,YAAY,CAAC;EACzC;EACA,OAAOF,iBAAiB;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,YAAYA,CAACC,MAAuB,EAAU;EAC5D,OAAO,CACLA,MAAM,CAACC,YAAY,EAAEC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,IAAI,EAAE,EAC/CH,MAAM,CAACI,SAAS,EAAEF,IAAI,CAAC,CAAC,IAAI,EAAE,EAC9BF,MAAM,CAACK,QAAQ,IAAI,EAAE,EACrBL,MAAM,CAACM,OAAO,EAAEJ,IAAI,CAAC,CAAC,IAAI,EAAE,CAC7B,CAACK,IAAI,CAAC,GAAG,CAAC;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAC/BR,MAAuB,EACvBS,WAA4B,EACnB;EACT,OAAOV,YAAY,CAACC,MAAM,CAAC,KAAKD,YAAY,CAACU,WAAW,CAAC;AAC3D;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC/B,UAAsC,EAAE;EACrE,MAAMgC,QAAQ,GAAG,wBAA0C;EAC3D,OAAOhC,UAAU,EAAES,KAAK,GACpBT,UAAU,CAACS,KAAK,CAACwB,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,UAAU,KAAKH,QAAQ,CAAC,GACvD,KAAK;AACX","ignoreList":[]}
1
+ {"version":3,"file":"helpers.js","names":["ComponentType","FORM_ACTION_COPY","hasComponents","isFormDefinition","definition","isConditionListItemRefValueData","conditionValueData","getConditionListItemIds","value","itemId","Array","isArray","getHiddenFields","pages","length","totalHiddenFields","page","hiddenFields","components","filter","comp","type","HiddenField","push","getOutputKey","output","emailAddress","trim","toLowerCase","condition","audience","version","join","isDuplicateOutput","otherOutput","isFeedbackForm","feedback","some","p","controller","isAllowCopyEnabled","formDefinition","options","metadata","allowCopy","getFormAction","messageMeta","custom","actionName","actionReferenceNumber","name","referenceNumber","undefined"],"sources":["../../../../src/form/form-definition/helpers.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport { type ConditionListItemRefValueDataV2 } from '~/src/conditions/types.js'\nimport { FORM_ACTION_COPY } from '~/src/form/form-definition/constants.js'\nimport {\n type FormDefinition,\n type Output\n} from '~/src/form/form-definition/types.js'\nimport { type ControllerType } from '~/src/pages/enums.js'\nimport { hasComponents } from '~/src/pages/helpers.js'\n\n/**\n * TypeGuard to check if something is a FormDefinition\n * @param { unknown } definition\n * @returns { definition is FormDefinition }\n */\nexport function isFormDefinition(\n definition: unknown\n): definition is FormDefinition {\n if (!definition) {\n return false\n }\n\n return (\n typeof definition === 'object' &&\n 'name' in definition &&\n 'pages' in definition &&\n 'conditions' in definition\n )\n}\n\n/**\n * TypeGuard to check if something is a ConditionListItemRefValueDataV2\n * @param { unknown } conditionValueData\n * @returns { conditionValueData is ConditionListItemRefValueDataV2 }\n */\nexport function isConditionListItemRefValueData(\n conditionValueData: unknown\n): conditionValueData is ConditionListItemRefValueDataV2 {\n if (!conditionValueData) {\n return false\n }\n\n return (\n typeof conditionValueData === 'object' &&\n 'listId' in conditionValueData &&\n 'itemId' in conditionValueData\n )\n}\n\n/**\n * Normalises a list item ref condition value to an array of item ids. `itemId`\n * is normally an array, but may be a bare string for legacy conditions saved\n * before multi-select support.\n * @param { ConditionListItemRefValueDataV2 | undefined } value\n * @returns { string[] }\n */\nexport function getConditionListItemIds(\n value: ConditionListItemRefValueDataV2 | undefined\n): string[] {\n if (!value?.itemId) {\n return []\n }\n\n return Array.isArray(value.itemId) ? value.itemId : [value.itemId]\n}\n\n/**\n * Returns an array of all hidden fields in a form\n * @param definition - form definition\n */\nexport function getHiddenFields(definition: FormDefinition) {\n if (definition.pages.length === 0) {\n return []\n }\n const totalHiddenFields = [] as ComponentDef[]\n for (const page of definition.pages) {\n const hiddenFields = hasComponents(page)\n ? page.components.filter(\n (comp) => comp.type === ComponentType.HiddenField\n )\n : []\n totalHiddenFields.push(...hiddenFields)\n }\n return totalHiddenFields\n}\n\n/**\n * Builds the key identifying a submission email target. Two outputs sharing a\n * key would send the same format of the same submission to the same inbox in\n * the same circumstances, so one of them is redundant. Addresses are compared\n * case-insensitively and a missing condition is treated as an empty one.\n * @param output - submission email target\n */\nexport function getOutputKey(output: Partial<Output>): string {\n return [\n output.emailAddress?.trim().toLowerCase() ?? '',\n output.condition?.trim() ?? '',\n output.audience ?? '',\n output.version?.trim() ?? ''\n ].join('|')\n}\n\n/**\n * Whether two submission email targets are duplicates of one another\n * @param output - submission email target\n * @param otherOutput - submission email target to compare against\n */\nexport function isDuplicateOutput(\n output: Partial<Output>,\n otherOutput: Partial<Output>\n): boolean {\n return getOutputKey(output) === getOutputKey(otherOutput)\n}\n\n/**\n * @param definition - form definition\n * @returns {boolean}\n */\nexport function isFeedbackForm(definition: FormDefinition | undefined) {\n const feedback = 'FeedbackPageController' as ControllerType\n return definition?.pages\n ? definition.pages.some((p) => p.controller === feedback)\n : false\n}\n\n/**\n * Checks whether the form allows answers to be reused from a previous\n * submission, as set by the metadata.options.allowCopy flag. forms-model does\n * not define metadata.options, so its type is checked here\n * @param {FormDefinition} formDefinition\n * @returns {boolean}\n */\nexport function isAllowCopyEnabled(formDefinition: FormDefinition): boolean {\n const options = formDefinition.metadata?.options\n\n return (\n typeof options === 'object' &&\n options !== null &&\n 'allowCopy' in options &&\n options.allowCopy === true\n )\n}\n\n/**\n * Retrieves the action details of the form submission, if any.\n * @param {{ custom?: { actionName?: string, actionReferenceNumber?: string } }} messageMeta\n * @param {FormDefinition} formDefinition\n * @returns\n */\nexport function getFormAction(\n messageMeta:\n | {\n custom?: { actionName?: string; actionReferenceNumber?: string }\n }\n | undefined,\n formDefinition: FormDefinition\n) {\n // 'Copy' action\n if (\n isAllowCopyEnabled(formDefinition) &&\n messageMeta?.custom?.actionName === FORM_ACTION_COPY &&\n messageMeta.custom.actionReferenceNumber\n ) {\n return {\n name: FORM_ACTION_COPY,\n referenceNumber:\n /** @type {string} */ messageMeta.custom.actionReferenceNumber\n }\n }\n\n return undefined\n}\n"],"mappings":"AAAA,SAASA,aAAa;AAGtB,SAASC,gBAAgB;AAMzB,SAASC,aAAa;;AAEtB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,UAAmB,EACW;EAC9B,IAAI,CAACA,UAAU,EAAE;IACf,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,UAAU,KAAK,QAAQ,IAC9B,MAAM,IAAIA,UAAU,IACpB,OAAO,IAAIA,UAAU,IACrB,YAAY,IAAIA,UAAU;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAC7CC,kBAA2B,EAC4B;EACvD,IAAI,CAACA,kBAAkB,EAAE;IACvB,OAAO,KAAK;EACd;EAEA,OACE,OAAOA,kBAAkB,KAAK,QAAQ,IACtC,QAAQ,IAAIA,kBAAkB,IAC9B,QAAQ,IAAIA,kBAAkB;AAElC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,KAAkD,EACxC;EACV,IAAI,CAACA,KAAK,EAAEC,MAAM,EAAE;IAClB,OAAO,EAAE;EACX;EAEA,OAAOC,KAAK,CAACC,OAAO,CAACH,KAAK,CAACC,MAAM,CAAC,GAAGD,KAAK,CAACC,MAAM,GAAG,CAACD,KAAK,CAACC,MAAM,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASG,eAA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AAQ,CAAC,GACvD,KAAK;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,kBAAkBA,CAACC,cAA8B,EAAW;EAC1E,MAAMC,OAAO,GAAGD,cAAc,CAACE,QAAQ,EAAED,OAAO;EAEhD,OACE,OAAOA,OAAO,KAAK,QAAQ,IAC3BA,OAAO,KAAK,IAAI,IAChB,WAAW,IAAIA,OAAO,IACtBA,OAAO,CAACE,SAAS,KAAK,IAAI;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAC3BC,WAIa,EACbL,cAA8B,EAC9B;EACA;EACA,IACED,kBAAkB,CAACC,cAAc,CAAC,IAClCK,WAAW,EAAEC,MAAM,EAAEC,UAAU,KAAK/C,gBAAgB,IACpD6C,WAAW,CAACC,MAAM,CAACE,qBAAqB,EACxC;IACA,OAAO;MACLC,IAAI,EAAEjD,gBAAgB;MACtBkD,eAAe,EACb,qBAAsBL,WAAW,CAACC,MAAM,CAACE;IAC7C,CAAC;EACH;EAEA,OAAOG,SAAS;AAClB","ignoreList":[]}
@@ -504,7 +504,7 @@ export const formDefinitionV2Schema = formDefinitionSchema.keys({
504
504
  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])),
505
505
  outputs: outputsSchemaV2
506
506
  }).description('Form definition schema for V2');
507
- export { MAX_NUMBER_OF_REPEAT_ITEMS, MIN_NUMBER_OF_REPEAT_ITEMS } from "./constants.js";
507
+ export { FORM_ACTION_COPY, MAX_NUMBER_OF_REPEAT_ITEMS, MIN_NUMBER_OF_REPEAT_ITEMS } from "./constants.js";
508
508
 
509
509
  // Maintain compatibility with legacy named export
510
510
  // E.g. `import { Schema } from '@defra/forms-model'`