@defra/forms-model 3.0.705 → 3.0.707
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/form/form-submission/enums.js +1 -0
- package/dist/module/form/form-submission/enums.js.map +1 -1
- package/dist/module/form/form-submission/index.js +23 -1
- package/dist/module/form/form-submission/index.js.map +1 -1
- package/dist/module/form/form-submission/types.js.map +1 -1
- package/dist/types/form/form-submission/enums.d.ts +2 -1
- package/dist/types/form/form-submission/enums.d.ts.map +1 -1
- package/dist/types/form/form-submission/index.d.ts +2 -1
- package/dist/types/form/form-submission/index.d.ts.map +1 -1
- package/dist/types/form/form-submission/types.d.ts +44 -2
- package/dist/types/form/form-submission/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/form/form-submission/enums.ts +2 -1
- package/src/form/form-submission/index.ts +27 -1
- package/src/form/form-submission/types.ts +49 -2
|
@@ -18,6 +18,7 @@ export let SubmissionEventMessageSource = /*#__PURE__*/function (SubmissionEvent
|
|
|
18
18
|
}({});
|
|
19
19
|
export let SubmissionEventMessageType = /*#__PURE__*/function (SubmissionEventMessageType) {
|
|
20
20
|
SubmissionEventMessageType["RUNNER_SAVE_AND_EXIT"] = "RUNNER_SAVE_AND_EXIT";
|
|
21
|
+
SubmissionEventMessageType["RUNNER_SAVE_AND_EXIT_V2"] = "RUNNER_SAVE_AND_EXIT_V2";
|
|
21
22
|
return SubmissionEventMessageType;
|
|
22
23
|
}({});
|
|
23
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","names":["SecurityQuestionsEnum","SubmissionEventMessageSchemaVersion","SubmissionEventMessageCategory","SubmissionEventMessageSource","SubmissionEventMessageType","ConditionEvaluationOutcome"],"sources":["../../../../src/form/form-submission/enums.ts"],"sourcesContent":["export enum SecurityQuestionsEnum {\n MemorablePlace = 'memorable-place',\n CharacterName = 'character-name',\n AudioRecommendation = 'audio-recommendation'\n}\n\nexport enum SubmissionEventMessageSchemaVersion {\n V1 = 1\n}\n\nexport enum SubmissionEventMessageCategory {\n RUNNER = 'RUNNER'\n}\n\nexport enum SubmissionEventMessageSource {\n FORMS_RUNNER = 'FORMS_RUNNER'\n}\n\nexport enum SubmissionEventMessageType {\n RUNNER_SAVE_AND_EXIT = 'RUNNER_SAVE_AND_EXIT'\n}\n\n/**\n * The outcome of evaluating a single form condition.\n *\n * `Error` is deliberately distinct from `False`. The runner defaults a failed\n * evaluation to `false` when routing, but for an audit record the two are not\n * the same thing and a consumer must be able to tell them apart.\n */\nexport enum ConditionEvaluationOutcome {\n /**\n * The condition evaluated to `true`\n */\n True = 'true',\n\n /**\n * The condition evaluated to `false`\n */\n False = 'false',\n\n /**\n * Evaluation threw - most commonly because the condition references a\n * component that is absent from the evaluation context, such as a component\n * on a repeater page. The runner treats this as `false`.\n */\n Error = 'error'\n}\n"],"mappings":"AAAA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAMjC,WAAYC,mCAAmC,0BAAnCA,mCAAmC;EAAnCA,mCAAmC,CAAnCA,mCAAmC;EAAA,OAAnCA,mCAAmC;AAAA;AAI/C,WAAYC,8BAA8B,0BAA9BA,8BAA8B;EAA9BA,8BAA8B;EAAA,OAA9BA,8BAA8B;AAAA;AAI1C,WAAYC,4BAA4B,0BAA5BA,4BAA4B;EAA5BA,4BAA4B;EAAA,OAA5BA,4BAA4B;AAAA;AAIxC,WAAYC,0BAA0B,0BAA1BA,0BAA0B;EAA1BA,0BAA0B;EAAA,OAA1BA,0BAA0B;AAAA;;
|
|
1
|
+
{"version":3,"file":"enums.js","names":["SecurityQuestionsEnum","SubmissionEventMessageSchemaVersion","SubmissionEventMessageCategory","SubmissionEventMessageSource","SubmissionEventMessageType","ConditionEvaluationOutcome"],"sources":["../../../../src/form/form-submission/enums.ts"],"sourcesContent":["export enum SecurityQuestionsEnum {\n MemorablePlace = 'memorable-place',\n CharacterName = 'character-name',\n AudioRecommendation = 'audio-recommendation'\n}\n\nexport enum SubmissionEventMessageSchemaVersion {\n V1 = 1\n}\n\nexport enum SubmissionEventMessageCategory {\n RUNNER = 'RUNNER'\n}\n\nexport enum SubmissionEventMessageSource {\n FORMS_RUNNER = 'FORMS_RUNNER'\n}\n\nexport enum SubmissionEventMessageType {\n RUNNER_SAVE_AND_EXIT = 'RUNNER_SAVE_AND_EXIT',\n RUNNER_SAVE_AND_EXIT_V2 = 'RUNNER_SAVE_AND_EXIT_V2'\n}\n\n/**\n * The outcome of evaluating a single form condition.\n *\n * `Error` is deliberately distinct from `False`. The runner defaults a failed\n * evaluation to `false` when routing, but for an audit record the two are not\n * the same thing and a consumer must be able to tell them apart.\n */\nexport enum ConditionEvaluationOutcome {\n /**\n * The condition evaluated to `true`\n */\n True = 'true',\n\n /**\n * The condition evaluated to `false`\n */\n False = 'false',\n\n /**\n * Evaluation threw - most commonly because the condition references a\n * component that is absent from the evaluation context, such as a component\n * on a repeater page. The runner treats this as `false`.\n */\n Error = 'error'\n}\n"],"mappings":"AAAA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAMjC,WAAYC,mCAAmC,0BAAnCA,mCAAmC;EAAnCA,mCAAmC,CAAnCA,mCAAmC;EAAA,OAAnCA,mCAAmC;AAAA;AAI/C,WAAYC,8BAA8B,0BAA9BA,8BAA8B;EAA9BA,8BAA8B;EAAA,OAA9BA,8BAA8B;AAAA;AAI1C,WAAYC,4BAA4B,0BAA5BA,4BAA4B;EAA5BA,4BAA4B;EAAA,OAA5BA,4BAA4B;AAAA;AAIxC,WAAYC,0BAA0B,0BAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAAA,OAA1BA,0BAA0B;AAAA;;AAKtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYC,0BAA0B,0BAA1BA,0BAA0B;EACpC;AACF;AACA;EAHYA,0BAA0B;EAMpC;AACF;AACA;EARYA,0BAA0B;EAWpC;AACF;AACA;AACA;AACA;EAfYA,0BAA0B;EAAA,OAA1BA,0BAA0B;AAAA","ignoreList":[]}
|
|
@@ -73,6 +73,22 @@ export const saveAndExitMessageData = Joi.object().keys({
|
|
|
73
73
|
state: Joi.object().required(),
|
|
74
74
|
magicLinkGroupId: Joi.string().optional()
|
|
75
75
|
}).label('SaveAndExitMessageData');
|
|
76
|
+
export const saveAndExitV2MessageData = Joi.object().keys({
|
|
77
|
+
form: Joi.object({
|
|
78
|
+
id: Joi.string().required(),
|
|
79
|
+
title: Joi.string().required(),
|
|
80
|
+
status: Joi.string().valid(FormStatus.Draft, FormStatus.Live).required(),
|
|
81
|
+
isPreview: Joi.boolean().required(),
|
|
82
|
+
baseUrl: Joi.string().required()
|
|
83
|
+
}).label('SaveAndExitForm'),
|
|
84
|
+
email: Joi.string().required(),
|
|
85
|
+
auth: Joi.object({
|
|
86
|
+
sub: Joi.string().required(),
|
|
87
|
+
issuer: Joi.string().required()
|
|
88
|
+
}),
|
|
89
|
+
state: Joi.object().required(),
|
|
90
|
+
magicLinkGroupId: Joi.string().optional()
|
|
91
|
+
}).label('SaveAndExitV2MessageData');
|
|
76
92
|
export const submissionMessageSchema = Joi.object().keys({
|
|
77
93
|
schemaVersion: Joi.string().valid(...Object.values(SubmissionEventMessageSchemaVersion)).required().description('The version of the SubmissionMessage - bumped with breaking changes'),
|
|
78
94
|
category: Joi.string().valid(...Object.values(SubmissionEventMessageCategory)).required().description('The message category - what does the entityId represent?'),
|
|
@@ -80,11 +96,17 @@ export const submissionMessageSchema = Joi.object().keys({
|
|
|
80
96
|
type: Joi.string().valid(...Object.values(SubmissionEventMessageType)).description('Event type'),
|
|
81
97
|
createdAt: Joi.date().required().description('The ISO timestamp where the action took place - should be the same as updated_at field in DB'),
|
|
82
98
|
messageCreatedAt: Joi.date().required().description('ISO timestamp when the message was published'),
|
|
83
|
-
data:
|
|
99
|
+
data: Joi.when('type', {
|
|
100
|
+
is: SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT,
|
|
101
|
+
then: saveAndExitMessageData,
|
|
102
|
+
otherwise: saveAndExitV2MessageData
|
|
103
|
+
})
|
|
84
104
|
});
|
|
85
105
|
export const notifyEmailMessageSchema = Joi.object().keys({
|
|
86
106
|
source: Joi.string().required(),
|
|
87
107
|
reason: Joi.string().required(),
|
|
108
|
+
formId: Joi.string().allow(''),
|
|
109
|
+
referenceNumber: Joi.string().allow(''),
|
|
88
110
|
templateId: Joi.string().required(),
|
|
89
111
|
emailAddress: Joi.string().email().required(),
|
|
90
112
|
personalisation: Joi.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Joi","FormStatus","ConditionEvaluationOutcome","SecurityQuestionsEnum","SubmissionEventMessageCategory","SubmissionEventMessageSchemaVersion","SubmissionEventMessageSource","SubmissionEventMessageType","formSubmitRecordSchema","object","name","string","required","description","title","value","allow","label","formSubmitRecordsetSchema","array","items","formSubmitConditionReferenceSchema","componentId","componentName","answered","boolean","formSubmitConditionEvaluationSchema","conditionId","outcome","valid","Object","values","references","formSubmitPayloadSchema","keys","retrievalKey","sessionId","referenceNumber","optional","language","main","repeaters","saveAndExitMessageData","form","id","status","Draft","Live","isPreview","baseUrl","email","security","question","answer","state","magicLinkGroupId","submissionMessageSchema","schemaVersion","category","source","type","createdAt","date","messageCreatedAt","data","notifyEmailMessageSchema","reason","templateId","emailAddress","personalisation","subject","body","notifyReplyToId"],"sources":["../../../../src/form/form-submission/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport { FormStatus } from '~/src/common/enums.js'\nimport {\n ConditionEvaluationOutcome,\n SecurityQuestionsEnum,\n SubmissionEventMessageCategory,\n SubmissionEventMessageSchemaVersion,\n SubmissionEventMessageSource,\n SubmissionEventMessageType\n} from '~/src/form/form-submission/enums.js'\nimport {\n type SaveAndExitMessage,\n type SaveAndExitMessageData,\n type SubmitConditionEvaluation,\n type SubmitConditionReference,\n type SubmitPayload,\n type SubmitRecord,\n type SubmitRecordset\n} from '~/src/form/form-submission/types.js'\n\n/**\n * Joi schema for `SubmitRecord` interface\n * @see {@link SubmitRecord}\n */\nexport const formSubmitRecordSchema = Joi.object<SubmitRecord>({\n name: Joi.string()\n .required()\n .description('Field identifier matching the component name'),\n title: Joi.string()\n .required()\n .description('Human-readable label for the field'),\n value: Joi.string()\n .required()\n .allow('')\n .description('User-submitted value for the field, may be empty')\n})\n .label('FormSubmitRecord')\n .description('Individual field value in a form submission')\n\n/**\n * Joi schema for `SubmitRecordset` interface\n * @see {@link SubmitRecordset}\n */\nexport const formSubmitRecordsetSchema = Joi.object<SubmitRecordset>({\n name: Joi.string()\n .required()\n .description('Identifier for the repeatable section'),\n title: Joi.string()\n .required()\n .description('Human-readable title for the repeatable section'),\n value: Joi.array<SubmitRecord[]>()\n .items(\n Joi.array<SubmitRecord>()\n .items(formSubmitRecordSchema)\n .required()\n .label('FormSubmitRecordGroup')\n )\n .required()\n .description(\n 'Array of record arrays, each representing a repeated instance'\n )\n})\n .label('FormSubmitRecordset')\n .description('Collection of repeated field values from a repeatable section')\n\n/**\n * Joi schema for `SubmitConditionReference` interface\n * @see {@link SubmitConditionReference}\n */\nexport const formSubmitConditionReferenceSchema =\n Joi.object<SubmitConditionReference>({\n componentId: Joi.string()\n .required()\n .description('Identifier of the component the condition depends on'),\n componentName: Joi.string()\n .required()\n .description(\n 'Name of the component the condition depends on, matching the submitted record name'\n ),\n answered: Joi.boolean()\n .required()\n .description(\n 'Whether the component held an answer when the condition was evaluated'\n )\n })\n .label('FormSubmitConditionReference')\n .description('A component a condition depends on, and its answered state')\n\n/**\n * Joi schema for `SubmitConditionEvaluation` interface\n * @see {@link SubmitConditionEvaluation}\n */\nexport const formSubmitConditionEvaluationSchema =\n Joi.object<SubmitConditionEvaluation>({\n conditionId: Joi.string()\n .required()\n .description('Identifier of the condition in the V2 form definition'),\n outcome: Joi.string()\n .valid(...Object.values(ConditionEvaluationOutcome))\n .required()\n .description('Result of evaluating the condition'),\n references: Joi.array<SubmitConditionReference>()\n .items(formSubmitConditionReferenceSchema)\n .required()\n .description(\n 'Components the condition depends on, including those reached through nested condition references'\n )\n })\n .label('FormSubmitConditionEvaluation')\n .description('Recorded outcome of a single condition at submission')\n\n/**\n * Joi schema for `SubmitPayload` interface\n * @see {@link SubmitPayload}\n */\nexport const formSubmitPayloadSchema = Joi.object<SubmitPayload>()\n .keys({\n retrievalKey: Joi.string()\n .required()\n .description('Unique key to retrieve this submission later'),\n sessionId: Joi.string()\n .required()\n .description('User session identifier for tracking and security'),\n referenceNumber: Joi.string()\n // TODO - make this required in later releases - optional for now to avoid release glitches\n .optional()\n .allow('')\n .description('Reference number for the form submission'),\n language: Joi.string()\n // TODO - make this required in later releases - optional for now to avoid release glitches\n .optional()\n .allow('')\n .description(\n 'The currently-selected language at point of form submission'\n ),\n main: Joi.array<SubmitRecord>()\n .items(formSubmitRecordSchema)\n .required()\n .description('Main (non-repeating) field values from the form'),\n repeaters: Joi.array<SubmitRecordset>()\n .items(formSubmitRecordsetSchema)\n .required()\n .description('Repeatable section values from the form')\n })\n .required()\n .label('FormSubmitPayload')\n .description('Complete form submission payload structure with all form data')\n\nexport const saveAndExitMessageData = Joi.object<SaveAndExitMessageData>()\n .keys({\n form: Joi.object({\n id: Joi.string().required(),\n title: Joi.string().required(),\n status: Joi.string().valid(FormStatus.Draft, FormStatus.Live).required(),\n isPreview: Joi.boolean().required(),\n baseUrl: Joi.string().required()\n }).label('SaveAndExitForm'),\n email: Joi.string().required(),\n security: Joi.object({\n question: Joi.string()\n .valid(...Object.values(SecurityQuestionsEnum))\n .required(),\n answer: Joi.string().required()\n }).label('SaveAndExitSecurity'),\n state: Joi.object().required(),\n magicLinkGroupId: Joi.string().optional()\n })\n .label('SaveAndExitMessageData')\n\nexport const submissionMessageSchema = Joi.object<SaveAndExitMessage>().keys({\n schemaVersion: Joi.string()\n .valid(...Object.values(SubmissionEventMessageSchemaVersion))\n .required()\n .description(\n 'The version of the SubmissionMessage - bumped with breaking changes'\n ),\n category: Joi.string()\n .valid(...Object.values(SubmissionEventMessageCategory))\n .required()\n .description('The message category - what does the entityId represent?'),\n source: Joi.string()\n .valid(...Object.values(SubmissionEventMessageSource))\n .required()\n .description('Source of the message - which service?'),\n type: Joi.string()\n .valid(...Object.values(SubmissionEventMessageType))\n .description('Event type'),\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 messageCreatedAt: Joi.date()\n .required()\n .description('ISO timestamp when the message was published'),\n data: saveAndExitMessageData\n})\n\nexport const notifyEmailMessageSchema = Joi.object()\n .keys({\n source: Joi.string().required(),\n reason: Joi.string().required(),\n templateId: Joi.string().required(),\n emailAddress: Joi.string().email().required(),\n personalisation: Joi.object({\n subject: Joi.string().required(),\n body: Joi.string().required()\n }),\n notifyReplyToId: Joi.string().optional()\n })\n .label('NotifyEmailData')\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB,SAASC,UAAU;AACnB,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,8BAA8B,EAC9BC,mCAAmC,EACnCC,4BAA4B,EAC5BC,0BAA0B;AAY5B;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGR,GAAG,CAACS,MAAM,CAAe;EAC7DC,IAAI,EAAEV,GAAG,CAACW,MAAM,CAAC,CAAC,CACfC,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,8CAA8C,CAAC;EAC9DC,KAAK,EAAEd,GAAG,CAACW,MAAM,CAAC,CAAC,CAChBC,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,oCAAoC,CAAC;EACpDE,KAAK,EAAEf,GAAG,CAACW,MAAM,CAAC,CAAC,CAChBC,QAAQ,CAAC,CAAC,CACVI,KAAK,CAAC,EAAE,CAAC,CACTH,WAAW,CAAC,kDA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;EAC5BgD,SAAS,EAAE7D,GAAG,CAAC8D,IAAI,CAAC,CAAC,CAClBlD,QAAQ,CAAC,CAAC,CACVC,WAAW,CACV,8FACF,CAAC;EACHkD,gBAAgB,EAAE/D,GAAG,CAAC8D,IAAI,CAAC,CAAC,CACzBlD,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,8CAA8C,CAAC;EAC9DmD,IAAI,EAAEtB;AACR,CAAC,CAAC;AAEF,OAAO,MAAMuB,wBAAwB,GAAGjE,GAAG,CAACS,MAAM,CAAC,CAAC,CACjDyB,IAAI,CAAC;EACJyB,MAAM,EAAE3D,GAAG,CAACW,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC/BsD,MAAM,EAAElE,GAAG,CAACW,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC/BuD,UAAU,EAAEnE,GAAG,CAACW,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACnCwD,YAAY,EAAEpE,GAAG,CAACW,MAAM,CAAC,CAAC,CAACuC,KAAK,CAAC,CAAC,CAACtC,QAAQ,CAAC,CAAC;EAC7CyD,eAAe,EAAErE,GAAG,CAACS,MAAM,CAAC;IAC1B6D,OAAO,EAAEtE,GAAG,CAACW,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;IAChC2D,IAAI,EAAEvE,GAAG,CAACW,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;EAC9B,CAAC,CAAC;EACF4D,eAAe,EAAExE,GAAG,CAACW,MAAM,CAAC,CAAC,CAAC2B,QAAQ,CAAC;AACzC,CAAC,CAAC,CACDrB,KAAK,CAAC,iBAAiB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Joi","FormStatus","ConditionEvaluationOutcome","SecurityQuestionsEnum","SubmissionEventMessageCategory","SubmissionEventMessageSchemaVersion","SubmissionEventMessageSource","SubmissionEventMessageType","formSubmitRecordSchema","object","name","string","required","description","title","value","allow","label","formSubmitRecordsetSchema","array","items","formSubmitConditionReferenceSchema","componentId","componentName","answered","boolean","formSubmitConditionEvaluationSchema","conditionId","outcome","valid","Object","values","references","formSubmitPayloadSchema","keys","retrievalKey","sessionId","referenceNumber","optional","language","main","repeaters","saveAndExitMessageData","form","id","status","Draft","Live","isPreview","baseUrl","email","security","question","answer","state","magicLinkGroupId","saveAndExitV2MessageData","auth","sub","issuer","submissionMessageSchema","schemaVersion","category","source","type","createdAt","date","messageCreatedAt","data","when","is","RUNNER_SAVE_AND_EXIT","then","otherwise","notifyEmailMessageSchema","reason","formId","templateId","emailAddress","personalisation","subject","body","notifyReplyToId"],"sources":["../../../../src/form/form-submission/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport { FormStatus } from '~/src/common/enums.js'\nimport {\n ConditionEvaluationOutcome,\n SecurityQuestionsEnum,\n SubmissionEventMessageCategory,\n SubmissionEventMessageSchemaVersion,\n SubmissionEventMessageSource,\n SubmissionEventMessageType\n} from '~/src/form/form-submission/enums.js'\nimport {\n type SaveAndExitMessage,\n type SaveAndExitMessageData,\n type SaveAndExitV2MessageData,\n type SubmitConditionEvaluation,\n type SubmitConditionReference,\n type SubmitPayload,\n type SubmitRecord,\n type SubmitRecordset\n} from '~/src/form/form-submission/types.js'\n\n/**\n * Joi schema for `SubmitRecord` interface\n * @see {@link SubmitRecord}\n */\nexport const formSubmitRecordSchema = Joi.object<SubmitRecord>({\n name: Joi.string()\n .required()\n .description('Field identifier matching the component name'),\n title: Joi.string()\n .required()\n .description('Human-readable label for the field'),\n value: Joi.string()\n .required()\n .allow('')\n .description('User-submitted value for the field, may be empty')\n})\n .label('FormSubmitRecord')\n .description('Individual field value in a form submission')\n\n/**\n * Joi schema for `SubmitRecordset` interface\n * @see {@link SubmitRecordset}\n */\nexport const formSubmitRecordsetSchema = Joi.object<SubmitRecordset>({\n name: Joi.string()\n .required()\n .description('Identifier for the repeatable section'),\n title: Joi.string()\n .required()\n .description('Human-readable title for the repeatable section'),\n value: Joi.array<SubmitRecord[]>()\n .items(\n Joi.array<SubmitRecord>()\n .items(formSubmitRecordSchema)\n .required()\n .label('FormSubmitRecordGroup')\n )\n .required()\n .description(\n 'Array of record arrays, each representing a repeated instance'\n )\n})\n .label('FormSubmitRecordset')\n .description('Collection of repeated field values from a repeatable section')\n\n/**\n * Joi schema for `SubmitConditionReference` interface\n * @see {@link SubmitConditionReference}\n */\nexport const formSubmitConditionReferenceSchema =\n Joi.object<SubmitConditionReference>({\n componentId: Joi.string()\n .required()\n .description('Identifier of the component the condition depends on'),\n componentName: Joi.string()\n .required()\n .description(\n 'Name of the component the condition depends on, matching the submitted record name'\n ),\n answered: Joi.boolean()\n .required()\n .description(\n 'Whether the component held an answer when the condition was evaluated'\n )\n })\n .label('FormSubmitConditionReference')\n .description('A component a condition depends on, and its answered state')\n\n/**\n * Joi schema for `SubmitConditionEvaluation` interface\n * @see {@link SubmitConditionEvaluation}\n */\nexport const formSubmitConditionEvaluationSchema =\n Joi.object<SubmitConditionEvaluation>({\n conditionId: Joi.string()\n .required()\n .description('Identifier of the condition in the V2 form definition'),\n outcome: Joi.string()\n .valid(...Object.values(ConditionEvaluationOutcome))\n .required()\n .description('Result of evaluating the condition'),\n references: Joi.array<SubmitConditionReference>()\n .items(formSubmitConditionReferenceSchema)\n .required()\n .description(\n 'Components the condition depends on, including those reached through nested condition references'\n )\n })\n .label('FormSubmitConditionEvaluation')\n .description('Recorded outcome of a single condition at submission')\n\n/**\n * Joi schema for `SubmitPayload` interface\n * @see {@link SubmitPayload}\n */\nexport const formSubmitPayloadSchema = Joi.object<SubmitPayload>()\n .keys({\n retrievalKey: Joi.string()\n .required()\n .description('Unique key to retrieve this submission later'),\n sessionId: Joi.string()\n .required()\n .description('User session identifier for tracking and security'),\n referenceNumber: Joi.string()\n // TODO - make this required in later releases - optional for now to avoid release glitches\n .optional()\n .allow('')\n .description('Reference number for the form submission'),\n language: Joi.string()\n // TODO - make this required in later releases - optional for now to avoid release glitches\n .optional()\n .allow('')\n .description(\n 'The currently-selected language at point of form submission'\n ),\n main: Joi.array<SubmitRecord>()\n .items(formSubmitRecordSchema)\n .required()\n .description('Main (non-repeating) field values from the form'),\n repeaters: Joi.array<SubmitRecordset>()\n .items(formSubmitRecordsetSchema)\n .required()\n .description('Repeatable section values from the form')\n })\n .required()\n .label('FormSubmitPayload')\n .description('Complete form submission payload structure with all form data')\n\nexport const saveAndExitMessageData = Joi.object<SaveAndExitMessageData>()\n .keys({\n form: Joi.object({\n id: Joi.string().required(),\n title: Joi.string().required(),\n status: Joi.string().valid(FormStatus.Draft, FormStatus.Live).required(),\n isPreview: Joi.boolean().required(),\n baseUrl: Joi.string().required()\n }).label('SaveAndExitForm'),\n email: Joi.string().required(),\n security: Joi.object({\n question: Joi.string()\n .valid(...Object.values(SecurityQuestionsEnum))\n .required(),\n answer: Joi.string().required()\n }).label('SaveAndExitSecurity'),\n state: Joi.object().required(),\n magicLinkGroupId: Joi.string().optional()\n })\n .label('SaveAndExitMessageData')\n\nexport const saveAndExitV2MessageData = Joi.object<SaveAndExitV2MessageData>()\n .keys({\n form: Joi.object({\n id: Joi.string().required(),\n title: Joi.string().required(),\n status: Joi.string().valid(FormStatus.Draft, FormStatus.Live).required(),\n isPreview: Joi.boolean().required(),\n baseUrl: Joi.string().required()\n }).label('SaveAndExitForm'),\n email: Joi.string().required(),\n auth: Joi.object({\n sub: Joi.string().required(),\n issuer: Joi.string().required()\n }),\n state: Joi.object().required(),\n magicLinkGroupId: Joi.string().optional()\n })\n .label('SaveAndExitV2MessageData')\n\nexport const submissionMessageSchema = Joi.object<SaveAndExitMessage>().keys({\n schemaVersion: Joi.string()\n .valid(...Object.values(SubmissionEventMessageSchemaVersion))\n .required()\n .description(\n 'The version of the SubmissionMessage - bumped with breaking changes'\n ),\n category: Joi.string()\n .valid(...Object.values(SubmissionEventMessageCategory))\n .required()\n .description('The message category - what does the entityId represent?'),\n source: Joi.string()\n .valid(...Object.values(SubmissionEventMessageSource))\n .required()\n .description('Source of the message - which service?'),\n type: Joi.string()\n .valid(...Object.values(SubmissionEventMessageType))\n .description('Event type'),\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 messageCreatedAt: Joi.date()\n .required()\n .description('ISO timestamp when the message was published'),\n data: Joi.when('type', {\n is: SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT,\n then: saveAndExitMessageData,\n otherwise: saveAndExitV2MessageData\n })\n})\n\nexport const notifyEmailMessageSchema = Joi.object()\n .keys({\n source: Joi.string().required(),\n reason: Joi.string().required(),\n formId: Joi.string().allow(''),\n referenceNumber: Joi.string().allow(''),\n templateId: Joi.string().required(),\n emailAddress: Joi.string().email().required(),\n personalisation: Joi.object({\n subject: Joi.string().required(),\n body: Joi.string().required()\n }),\n notifyReplyToId: Joi.string().optional()\n })\n .label('NotifyEmailData')\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB,SAASC,UAAU;AACnB,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,8BAA8B,EAC9BC,mCAAmC,EACnCC,4BAA4B,EAC5BC,0BAA0B;AAa5B;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGR,GAAG,CAACS,MAAM,CAAe;EAC7DC,IAAI,EAAEV,GAAG,CAACW,MAAM,CAAC,CAAC,CACfC,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,8CAA8C,CAAC;EAC9DC,KAAK,EAAEd,GAAG,CAACW,MAAM,CAAC,CAAC,CAChBC,QAAQ,CAAC,CAAC,CACVC,WAAW,CAAC,oCAAoC,CAAC;EACpDE,KAAK,EAAEf,GAAG,CAACW,MAAM,CAAC,CAAC,CAChBC,QAAQ,CAAC,CAAC,CACVI,KAAK,CAAC,EAAE,CAAC,CACTH,WAAW,CAAC,kDAAkD;AACnE,CAAC,CAAC,CACCI,KAAK,CAAC,kBAAkB,CAAC,CACzBJ,WAAW,CAAC,6CAA6C,CAAC;;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"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-submission/types.ts"],"sourcesContent":["import { type FormStatus } from '~/src/common/enums.js'\nimport {\n type ConditionEvaluationOutcome,\n type SecurityQuestionsEnum,\n type SubmissionEventMessageCategory,\n type SubmissionEventMessageSchemaVersion,\n type SubmissionEventMessageSource,\n type SubmissionEventMessageType\n} from '~/src/form/form-submission/enums.js'\nimport {\n formSubmitConditionEvaluationSchema,\n formSubmitConditionReferenceSchema,\n formSubmitPayloadSchema,\n formSubmitRecordSchema,\n formSubmitRecordsetSchema\n} from '~/src/form/form-submission/index.js'\n\n/**\n * Interface for an individual submit record\n * @see {@link formSubmitRecordSchema}\n */\nexport interface SubmitRecord {\n /**\n * The field name\n */\n name: string\n\n /**\n * The field title\n */\n title: string\n\n /**\n * The field display value\n */\n value: string\n}\n\n/**\n * Interface for an individual submit recordset (e.g. a repeater question set)\n * @see {@link formSubmitRecordsetSchema}\n */\nexport interface SubmitRecordset {\n /**\n * The name of the recordset\n */\n name: string\n\n /**\n * The title of the recordset\n */\n title: string\n\n /**\n * The record items\n */\n value: SubmitRecord[][]\n}\n\n/**\n * A component referenced by a condition, and whether the user had answered it\n * when the condition was evaluated.\n *\n * An unanswered question is not absent from the runner's evaluation context -\n * it is present as `null` - so conditions still return a boolean for questions\n * that were skipped or never reached. Negative operators (\"is not\", \"is shorter\n * than\") return `true` in that case. Without knowing which referenced questions\n * were answered, a consumer cannot tell a real match from a vacuous one.\n * @see {@link formSubmitConditionReferenceSchema}\n */\nexport interface SubmitConditionReference {\n /**\n * The id of the referenced component\n */\n componentId: string\n\n /**\n * The name of the referenced component, as used in the submitted records\n */\n componentName: string\n\n /**\n * Whether the referenced component held an answer at the point of evaluation\n */\n answered: boolean\n}\n\n/**\n * The recorded outcome of a single condition at the point of submission.\n * V2 forms only - V1 conditions are not captured.\n * @see {@link formSubmitConditionEvaluationSchema}\n */\nexport interface SubmitConditionEvaluation {\n /**\n * The id of the condition, as authored in the V2 form definition\n */\n conditionId: string\n\n /**\n * The result of evaluating the condition\n */\n outcome: ConditionEvaluationOutcome\n\n /**\n * Every component the condition depends on, including those reached through\n * nested condition references, and whether each was answered\n */\n references: SubmitConditionReference[]\n}\n\n/**\n * Interface for the submission-api `/submit` payload\n * @see {@link formSubmitPayloadSchema}\n */\nexport interface SubmitPayload {\n /**\n * The retrieval key for files created in the submission\n */\n retrievalKey: string\n\n /**\n * The id of the user session\n */\n sessionId: string\n\n /**\n * The reference number of the user session\n */\n referenceNumber?: string\n\n /**\n * The currently-selected language at the point of submission\n */\n language?: string\n\n /**\n * The main form anwsers\n */\n main: SubmitRecord[]\n\n /**\n * The repeaters form answers\n */\n repeaters: SubmitRecordset[]\n}\n\n/**\n * Interface for the submission-api `/submit` response payload\n */\nexport interface SubmitResponsePayload {\n message: string\n result: {\n files: {\n main: string\n repeaters: Record<string, string>\n }\n }\n}\n\nexport interface SaveAndExitMessageData {\n magicLinkGroupId?: string\n form: {\n id: string\n title: string\n status: FormStatus\n isPreview: boolean\n baseUrl: string\n }\n email: string\n security: {\n question: SecurityQuestionsEnum\n answer: string\n }\n state: object\n}\n\nexport interface SaveAndExitMessage {\n schemaVersion: SubmissionEventMessageSchemaVersion\n source: SubmissionEventMessageSource\n createdAt: Date\n messageCreatedAt: Date\n category: SubmissionEventMessageCategory.RUNNER\n type
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-submission/types.ts"],"sourcesContent":["import { type FormStatus } from '~/src/common/enums.js'\nimport {\n type ConditionEvaluationOutcome,\n type SecurityQuestionsEnum,\n type SubmissionEventMessageCategory,\n type SubmissionEventMessageSchemaVersion,\n type SubmissionEventMessageSource,\n type SubmissionEventMessageType\n} from '~/src/form/form-submission/enums.js'\nimport {\n formSubmitConditionEvaluationSchema,\n formSubmitConditionReferenceSchema,\n formSubmitPayloadSchema,\n formSubmitRecordSchema,\n formSubmitRecordsetSchema\n} from '~/src/form/form-submission/index.js'\n\n/**\n * Interface for an individual submit record\n * @see {@link formSubmitRecordSchema}\n */\nexport interface SubmitRecord {\n /**\n * The field name\n */\n name: string\n\n /**\n * The field title\n */\n title: string\n\n /**\n * The field display value\n */\n value: string\n}\n\n/**\n * Interface for an individual submit recordset (e.g. a repeater question set)\n * @see {@link formSubmitRecordsetSchema}\n */\nexport interface SubmitRecordset {\n /**\n * The name of the recordset\n */\n name: string\n\n /**\n * The title of the recordset\n */\n title: string\n\n /**\n * The record items\n */\n value: SubmitRecord[][]\n}\n\n/**\n * A component referenced by a condition, and whether the user had answered it\n * when the condition was evaluated.\n *\n * An unanswered question is not absent from the runner's evaluation context -\n * it is present as `null` - so conditions still return a boolean for questions\n * that were skipped or never reached. Negative operators (\"is not\", \"is shorter\n * than\") return `true` in that case. Without knowing which referenced questions\n * were answered, a consumer cannot tell a real match from a vacuous one.\n * @see {@link formSubmitConditionReferenceSchema}\n */\nexport interface SubmitConditionReference {\n /**\n * The id of the referenced component\n */\n componentId: string\n\n /**\n * The name of the referenced component, as used in the submitted records\n */\n componentName: string\n\n /**\n * Whether the referenced component held an answer at the point of evaluation\n */\n answered: boolean\n}\n\n/**\n * The recorded outcome of a single condition at the point of submission.\n * V2 forms only - V1 conditions are not captured.\n * @see {@link formSubmitConditionEvaluationSchema}\n */\nexport interface SubmitConditionEvaluation {\n /**\n * The id of the condition, as authored in the V2 form definition\n */\n conditionId: string\n\n /**\n * The result of evaluating the condition\n */\n outcome: ConditionEvaluationOutcome\n\n /**\n * Every component the condition depends on, including those reached through\n * nested condition references, and whether each was answered\n */\n references: SubmitConditionReference[]\n}\n\n/**\n * Interface for the submission-api `/submit` payload\n * @see {@link formSubmitPayloadSchema}\n */\nexport interface SubmitPayload {\n /**\n * The retrieval key for files created in the submission\n */\n retrievalKey: string\n\n /**\n * The id of the user session\n */\n sessionId: string\n\n /**\n * The reference number of the user session\n */\n referenceNumber?: string\n\n /**\n * The currently-selected language at the point of submission\n */\n language?: string\n\n /**\n * The main form anwsers\n */\n main: SubmitRecord[]\n\n /**\n * The repeaters form answers\n */\n repeaters: SubmitRecordset[]\n}\n\n/**\n * Interface for the submission-api `/submit` response payload\n */\nexport interface SubmitResponsePayload {\n message: string\n result: {\n files: {\n main: string\n repeaters: Record<string, string>\n }\n }\n}\n\nexport interface SaveAndExitMessageData {\n magicLinkGroupId?: string\n form: {\n id: string\n title: string\n status: FormStatus\n isPreview: boolean\n baseUrl: string\n }\n email: string\n security: {\n question: SecurityQuestionsEnum\n answer: string\n }\n state: object\n}\n\nexport interface SaveAndExitV2MessageData {\n magicLinkGroupId?: string\n form: {\n id: string\n title: string\n status: FormStatus\n isPreview: boolean\n baseUrl: string\n }\n email: string\n auth: {\n sub: string\n issuer: string\n }\n state: object\n}\n\nexport interface SaveAndExitMessage {\n schemaVersion: SubmissionEventMessageSchemaVersion\n source: SubmissionEventMessageSource\n createdAt: Date\n messageCreatedAt: Date\n category: SubmissionEventMessageCategory.RUNNER\n type:\n | SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT\n | SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT_V2\n data: SaveAndExitMessageData\n}\n\nexport interface SaveAndExitV2Message {\n schemaVersion: SubmissionEventMessageSchemaVersion\n source: SubmissionEventMessageSource\n createdAt: Date\n messageCreatedAt: Date\n category: SubmissionEventMessageCategory.RUNNER\n type: SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT_V2\n data: SaveAndExitV2MessageData\n}\n\nexport interface SaveAndExitRecord {\n magicLinkId: string\n magicLinkGroupId?: string\n form: {\n id: string\n status: FormStatus\n isPreview: boolean\n baseUrl: string\n }\n email: string\n security: {\n question: SecurityQuestionsEnum\n answer: string\n }\n state: object\n invalidPasswordAttempts: number\n createdAt: Date\n}\n\nexport interface SaveAndExitV2Record {\n magicLinkId: string\n magicLinkGroupId?: string\n form: {\n id: string\n status: FormStatus\n isPreview: boolean\n baseUrl: string\n }\n email: string\n auth: {\n sub: string\n issuer: string\n }\n state: object\n createdAt: Date\n}\n\nexport type RunnerMessage = SaveAndExitMessage\n\nexport interface RunnerRecordBase {\n messageId: string\n recordCreatedAt: Date\n}\n\nexport interface RunnerRecordInputMeta extends RunnerRecordBase {\n id: string\n}\n\nexport type RunnerRecordInput = RunnerMessage & RunnerRecordBase\n\nexport type RunnerRecord = RunnerMessage & RunnerRecordInputMeta\n"],"mappings":"","ignoreList":[]}
|
|
@@ -13,7 +13,8 @@ export declare enum SubmissionEventMessageSource {
|
|
|
13
13
|
FORMS_RUNNER = "FORMS_RUNNER"
|
|
14
14
|
}
|
|
15
15
|
export declare enum SubmissionEventMessageType {
|
|
16
|
-
RUNNER_SAVE_AND_EXIT = "RUNNER_SAVE_AND_EXIT"
|
|
16
|
+
RUNNER_SAVE_AND_EXIT = "RUNNER_SAVE_AND_EXIT",
|
|
17
|
+
RUNNER_SAVE_AND_EXIT_V2 = "RUNNER_SAVE_AND_EXIT_V2"
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* The outcome of evaluating a single form condition.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../src/form/form-submission/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,qBAAqB;IAC/B,cAAc,oBAAoB;IAClC,aAAa,mBAAmB;IAChC,mBAAmB,yBAAyB;CAC7C;AAED,oBAAY,mCAAmC;IAC7C,EAAE,IAAI;CACP;AAED,oBAAY,8BAA8B;IACxC,MAAM,WAAW;CAClB;AAED,oBAAY,4BAA4B;IACtC,YAAY,iBAAiB;CAC9B;AAED,oBAAY,0BAA0B;IACpC,oBAAoB,yBAAyB;
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../src/form/form-submission/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,qBAAqB;IAC/B,cAAc,oBAAoB;IAClC,aAAa,mBAAmB;IAChC,mBAAmB,yBAAyB;CAC7C;AAED,oBAAY,mCAAmC;IAC7C,EAAE,IAAI;CACP;AAED,oBAAY,8BAA8B;IACxC,MAAM,WAAW;CAClB;AAED,oBAAY,4BAA4B;IACtC,YAAY,iBAAiB;CAC9B;AAED,oBAAY,0BAA0B;IACpC,oBAAoB,yBAAyB;IAC7C,uBAAuB,4BAA4B;CACpD;AAED;;;;;;GAMG;AACH,oBAAY,0BAA0B;IACpC;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,KAAK,UAAU;IAEf;;;;OAIG;IACH,KAAK,UAAU;CAChB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
|
-
import { type SaveAndExitMessage, type SaveAndExitMessageData, type SubmitConditionEvaluation, type SubmitConditionReference, type SubmitPayload, type SubmitRecord, type SubmitRecordset } from '../../form/form-submission/types.js';
|
|
2
|
+
import { type SaveAndExitMessage, type SaveAndExitMessageData, type SaveAndExitV2MessageData, type SubmitConditionEvaluation, type SubmitConditionReference, type SubmitPayload, type SubmitRecord, type SubmitRecordset } from '../../form/form-submission/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Joi schema for `SubmitRecord` interface
|
|
5
5
|
* @see {@link SubmitRecord}
|
|
@@ -26,6 +26,7 @@ export declare const formSubmitConditionEvaluationSchema: Joi.ObjectSchema<Submi
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const formSubmitPayloadSchema: Joi.ObjectSchema<SubmitPayload>;
|
|
28
28
|
export declare const saveAndExitMessageData: Joi.ObjectSchema<SaveAndExitMessageData>;
|
|
29
|
+
export declare const saveAndExitV2MessageData: Joi.ObjectSchema<SaveAndExitV2MessageData>;
|
|
29
30
|
export declare const submissionMessageSchema: Joi.ObjectSchema<SaveAndExitMessage>;
|
|
30
31
|
export declare const notifyEmailMessageSchema: Joi.ObjectSchema<any>;
|
|
31
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-submission/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,M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,eAAO,MAAM,uBAAuB,sCA+BlC,CAAA;AAEF,eAAO,MAAM,wBAAwB,uBAcV,CAAA"}
|
|
@@ -139,18 +139,43 @@ export interface SaveAndExitMessageData {
|
|
|
139
139
|
};
|
|
140
140
|
state: object;
|
|
141
141
|
}
|
|
142
|
+
export interface SaveAndExitV2MessageData {
|
|
143
|
+
magicLinkGroupId?: string;
|
|
144
|
+
form: {
|
|
145
|
+
id: string;
|
|
146
|
+
title: string;
|
|
147
|
+
status: FormStatus;
|
|
148
|
+
isPreview: boolean;
|
|
149
|
+
baseUrl: string;
|
|
150
|
+
};
|
|
151
|
+
email: string;
|
|
152
|
+
auth: {
|
|
153
|
+
sub: string;
|
|
154
|
+
issuer: string;
|
|
155
|
+
};
|
|
156
|
+
state: object;
|
|
157
|
+
}
|
|
142
158
|
export interface SaveAndExitMessage {
|
|
143
159
|
schemaVersion: SubmissionEventMessageSchemaVersion;
|
|
144
160
|
source: SubmissionEventMessageSource;
|
|
145
161
|
createdAt: Date;
|
|
146
162
|
messageCreatedAt: Date;
|
|
147
163
|
category: SubmissionEventMessageCategory.RUNNER;
|
|
148
|
-
type: SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT;
|
|
164
|
+
type: SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT | SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT_V2;
|
|
149
165
|
data: SaveAndExitMessageData;
|
|
150
166
|
}
|
|
167
|
+
export interface SaveAndExitV2Message {
|
|
168
|
+
schemaVersion: SubmissionEventMessageSchemaVersion;
|
|
169
|
+
source: SubmissionEventMessageSource;
|
|
170
|
+
createdAt: Date;
|
|
171
|
+
messageCreatedAt: Date;
|
|
172
|
+
category: SubmissionEventMessageCategory.RUNNER;
|
|
173
|
+
type: SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT_V2;
|
|
174
|
+
data: SaveAndExitV2MessageData;
|
|
175
|
+
}
|
|
151
176
|
export interface SaveAndExitRecord {
|
|
152
177
|
magicLinkId: string;
|
|
153
|
-
magicLinkGroupId
|
|
178
|
+
magicLinkGroupId?: string;
|
|
154
179
|
form: {
|
|
155
180
|
id: string;
|
|
156
181
|
status: FormStatus;
|
|
@@ -166,6 +191,23 @@ export interface SaveAndExitRecord {
|
|
|
166
191
|
invalidPasswordAttempts: number;
|
|
167
192
|
createdAt: Date;
|
|
168
193
|
}
|
|
194
|
+
export interface SaveAndExitV2Record {
|
|
195
|
+
magicLinkId: string;
|
|
196
|
+
magicLinkGroupId?: string;
|
|
197
|
+
form: {
|
|
198
|
+
id: string;
|
|
199
|
+
status: FormStatus;
|
|
200
|
+
isPreview: boolean;
|
|
201
|
+
baseUrl: string;
|
|
202
|
+
};
|
|
203
|
+
email: string;
|
|
204
|
+
auth: {
|
|
205
|
+
sub: string;
|
|
206
|
+
issuer: string;
|
|
207
|
+
};
|
|
208
|
+
state: object;
|
|
209
|
+
createdAt: Date;
|
|
210
|
+
}
|
|
169
211
|
export type RunnerMessage = SaveAndExitMessage;
|
|
170
212
|
export interface RunnerRecordBase {
|
|
171
213
|
messageId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-submission/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EACnC,KAAK,mCAAmC,EACxC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAChC,MAAM,qCAAqC,CAAA;AAS5C;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,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O,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE;QACR,QAAQ,EAAE,qBAAqB,CAAA;QAC/B,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,mCAAmC,CAAA;IAClD,MAAM,EAAE,4BAA4B,CAAA;IACpC,SAAS,EAAE,IAAI,CAAA;IACf,gBAAgB,EAAE,IAAI,CAAA;IACtB,QAAQ,EAAE,8BAA8B,CAAC,MAAM,CAAA;IAC/C,IAAI,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-submission/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EACnC,KAAK,mCAAmC,EACxC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAChC,MAAM,qCAAqC,CAAA;AAS5C;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,KAAK,EAAE,YAAY,EAAE,EAAE,CAAA;CACxB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAA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AE,MAAM,CAAA;KACf,CAAA;IACD,KAAK,EAAE,MAAM,CAAA;IACb,uBAAuB,EAAE,MAAM,CAAA;IAC/B,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAA;QACV,MAAM,EAAE,UAAU,CAAA;QAClB,SAAS,EAAE,OAAO,CAAA;QAClB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAA;QACX,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAA;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,IAAI,CAAA;CACtB;AAED,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,gBAAgB,CAAA;AAEhE,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,qBAAqB,CAAA"}
|
package/package.json
CHANGED
|
@@ -17,7 +17,8 @@ export enum SubmissionEventMessageSource {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export enum SubmissionEventMessageType {
|
|
20
|
-
RUNNER_SAVE_AND_EXIT = 'RUNNER_SAVE_AND_EXIT'
|
|
20
|
+
RUNNER_SAVE_AND_EXIT = 'RUNNER_SAVE_AND_EXIT',
|
|
21
|
+
RUNNER_SAVE_AND_EXIT_V2 = 'RUNNER_SAVE_AND_EXIT_V2'
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
type SaveAndExitMessage,
|
|
14
14
|
type SaveAndExitMessageData,
|
|
15
|
+
type SaveAndExitV2MessageData,
|
|
15
16
|
type SubmitConditionEvaluation,
|
|
16
17
|
type SubmitConditionReference,
|
|
17
18
|
type SubmitPayload,
|
|
@@ -168,6 +169,25 @@ export const saveAndExitMessageData = Joi.object<SaveAndExitMessageData>()
|
|
|
168
169
|
})
|
|
169
170
|
.label('SaveAndExitMessageData')
|
|
170
171
|
|
|
172
|
+
export const saveAndExitV2MessageData = Joi.object<SaveAndExitV2MessageData>()
|
|
173
|
+
.keys({
|
|
174
|
+
form: Joi.object({
|
|
175
|
+
id: Joi.string().required(),
|
|
176
|
+
title: Joi.string().required(),
|
|
177
|
+
status: Joi.string().valid(FormStatus.Draft, FormStatus.Live).required(),
|
|
178
|
+
isPreview: Joi.boolean().required(),
|
|
179
|
+
baseUrl: Joi.string().required()
|
|
180
|
+
}).label('SaveAndExitForm'),
|
|
181
|
+
email: Joi.string().required(),
|
|
182
|
+
auth: Joi.object({
|
|
183
|
+
sub: Joi.string().required(),
|
|
184
|
+
issuer: Joi.string().required()
|
|
185
|
+
}),
|
|
186
|
+
state: Joi.object().required(),
|
|
187
|
+
magicLinkGroupId: Joi.string().optional()
|
|
188
|
+
})
|
|
189
|
+
.label('SaveAndExitV2MessageData')
|
|
190
|
+
|
|
171
191
|
export const submissionMessageSchema = Joi.object<SaveAndExitMessage>().keys({
|
|
172
192
|
schemaVersion: Joi.string()
|
|
173
193
|
.valid(...Object.values(SubmissionEventMessageSchemaVersion))
|
|
@@ -194,13 +214,19 @@ export const submissionMessageSchema = Joi.object<SaveAndExitMessage>().keys({
|
|
|
194
214
|
messageCreatedAt: Joi.date()
|
|
195
215
|
.required()
|
|
196
216
|
.description('ISO timestamp when the message was published'),
|
|
197
|
-
data:
|
|
217
|
+
data: Joi.when('type', {
|
|
218
|
+
is: SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT,
|
|
219
|
+
then: saveAndExitMessageData,
|
|
220
|
+
otherwise: saveAndExitV2MessageData
|
|
221
|
+
})
|
|
198
222
|
})
|
|
199
223
|
|
|
200
224
|
export const notifyEmailMessageSchema = Joi.object()
|
|
201
225
|
.keys({
|
|
202
226
|
source: Joi.string().required(),
|
|
203
227
|
reason: Joi.string().required(),
|
|
228
|
+
formId: Joi.string().allow(''),
|
|
229
|
+
referenceNumber: Joi.string().allow(''),
|
|
204
230
|
templateId: Joi.string().required(),
|
|
205
231
|
emailAddress: Joi.string().email().required(),
|
|
206
232
|
personalisation: Joi.object({
|
|
@@ -174,19 +174,48 @@ export interface SaveAndExitMessageData {
|
|
|
174
174
|
state: object
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
export interface SaveAndExitV2MessageData {
|
|
178
|
+
magicLinkGroupId?: string
|
|
179
|
+
form: {
|
|
180
|
+
id: string
|
|
181
|
+
title: string
|
|
182
|
+
status: FormStatus
|
|
183
|
+
isPreview: boolean
|
|
184
|
+
baseUrl: string
|
|
185
|
+
}
|
|
186
|
+
email: string
|
|
187
|
+
auth: {
|
|
188
|
+
sub: string
|
|
189
|
+
issuer: string
|
|
190
|
+
}
|
|
191
|
+
state: object
|
|
192
|
+
}
|
|
193
|
+
|
|
177
194
|
export interface SaveAndExitMessage {
|
|
178
195
|
schemaVersion: SubmissionEventMessageSchemaVersion
|
|
179
196
|
source: SubmissionEventMessageSource
|
|
180
197
|
createdAt: Date
|
|
181
198
|
messageCreatedAt: Date
|
|
182
199
|
category: SubmissionEventMessageCategory.RUNNER
|
|
183
|
-
type:
|
|
200
|
+
type:
|
|
201
|
+
| SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT
|
|
202
|
+
| SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT_V2
|
|
184
203
|
data: SaveAndExitMessageData
|
|
185
204
|
}
|
|
186
205
|
|
|
206
|
+
export interface SaveAndExitV2Message {
|
|
207
|
+
schemaVersion: SubmissionEventMessageSchemaVersion
|
|
208
|
+
source: SubmissionEventMessageSource
|
|
209
|
+
createdAt: Date
|
|
210
|
+
messageCreatedAt: Date
|
|
211
|
+
category: SubmissionEventMessageCategory.RUNNER
|
|
212
|
+
type: SubmissionEventMessageType.RUNNER_SAVE_AND_EXIT_V2
|
|
213
|
+
data: SaveAndExitV2MessageData
|
|
214
|
+
}
|
|
215
|
+
|
|
187
216
|
export interface SaveAndExitRecord {
|
|
188
217
|
magicLinkId: string
|
|
189
|
-
magicLinkGroupId
|
|
218
|
+
magicLinkGroupId?: string
|
|
190
219
|
form: {
|
|
191
220
|
id: string
|
|
192
221
|
status: FormStatus
|
|
@@ -203,6 +232,24 @@ export interface SaveAndExitRecord {
|
|
|
203
232
|
createdAt: Date
|
|
204
233
|
}
|
|
205
234
|
|
|
235
|
+
export interface SaveAndExitV2Record {
|
|
236
|
+
magicLinkId: string
|
|
237
|
+
magicLinkGroupId?: string
|
|
238
|
+
form: {
|
|
239
|
+
id: string
|
|
240
|
+
status: FormStatus
|
|
241
|
+
isPreview: boolean
|
|
242
|
+
baseUrl: string
|
|
243
|
+
}
|
|
244
|
+
email: string
|
|
245
|
+
auth: {
|
|
246
|
+
sub: string
|
|
247
|
+
issuer: string
|
|
248
|
+
}
|
|
249
|
+
state: object
|
|
250
|
+
createdAt: Date
|
|
251
|
+
}
|
|
252
|
+
|
|
206
253
|
export type RunnerMessage = SaveAndExitMessage
|
|
207
254
|
|
|
208
255
|
export interface RunnerRecordBase {
|