@defra/forms-model 3.0.316 → 3.0.317

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.
@@ -15,6 +15,26 @@ export const teamEmailSchema = Joi.string().email({
15
15
  export const privacyNoticeUrlSchema = Joi.string().uri({
16
16
  scheme: ['http', 'https']
17
17
  }).trim();
18
+ export const phoneSchema = Joi.string().trim();
19
+ export const emailAddressSchema = Joi.string().email().trim().required();
20
+ export const emailResponseTimeSchema = Joi.string().trim().required();
21
+ export const emailSchema = Joi.object().keys({
22
+ address: emailAddressSchema,
23
+ responseTime: emailResponseTimeSchema
24
+ });
25
+ export const onlineUrlSchema = Joi.string().uri({
26
+ scheme: ['http', 'https']
27
+ }).trim().required();
28
+ export const onlineTextSchema = Joi.string().trim().required();
29
+ export const onlineSchema = Joi.object().keys({
30
+ url: onlineUrlSchema,
31
+ text: onlineTextSchema
32
+ });
33
+ export const contactSchema = Joi.object().keys({
34
+ phone: phoneSchema,
35
+ email: emailSchema,
36
+ online: onlineSchema
37
+ });
18
38
  export const authoredAtSchema = Joi.date().iso().required();
19
39
  export const authorIdSchema = Joi.string().trim().required();
20
40
  export const authorDisplayNameSchema = Joi.string().trim().required();
@@ -23,7 +43,8 @@ export const formMetadataInputKeys = {
23
43
  organisation: organisationSchema,
24
44
  teamName: teamNameSchema,
25
45
  teamEmail: teamEmailSchema,
26
- privacyNoticeUrl: privacyNoticeUrlSchema
46
+ privacyNoticeUrl: privacyNoticeUrlSchema,
47
+ contact: contactSchema
27
48
  };
28
49
 
29
50
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Joi","organisations","idSchema","string","hex","length","required","titleSchema","max","trim","slugSchema","pattern","name","organisationSchema","valid","teamNameSchema","teamEmailSchema","email","tlds","allow","privacyNoticeUrlSchema","uri","scheme","authoredAtSchema","date","iso","authorIdSchema","authorDisplayNameSchema","formMetadataInputKeys","title","organisation","teamName","teamEmail","privacyNoticeUrl","formMetadataInputSchema","object","keys","formMetadataAuthorSchema","id","displayName","formMetadataStateSchema","createdAt","createdBy","updatedAt","updatedBy","formMetadataSchema","append","slug","draft","live"],"sources":["../../../../src/form/form-metadata/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport {\n type FormMetadata,\n type FormMetadataInput,\n type FormMetadataState,\n type FormMetadataAuthor\n} from '~/src/form/form-metadata/types.js'\n\nexport const organisations = [\n 'Animal and Plant Health Agency – APHA',\n 'Centre for Environment, Fisheries and Aquaculture Science – Cefas',\n 'Defra',\n 'Environment Agency',\n 'Forestry Commission',\n 'Marine Management Organisation – MMO',\n 'Natural England',\n 'Rural Payments Agency – RPA',\n 'Veterinary Medicines Directorate – VMD'\n]\n\nexport const idSchema = Joi.string().hex().length(24).required()\nexport const titleSchema = Joi.string().max(250).trim().required()\nexport const slugSchema = Joi.string()\n .pattern(/^[a-z0-9-]+$/, { name: 'letters, numbers and hyphens only' })\n .required()\n\nexport const organisationSchema = Joi.string()\n .valid(...organisations)\n .required()\n\nexport const teamNameSchema = Joi.string().max(100).trim().required()\nexport const teamEmailSchema = Joi.string()\n .email({ tlds: { allow: ['uk'] } })\n .trim()\n .required()\n\nexport const privacyNoticeUrlSchema = Joi.string()\n .uri({\n scheme: ['http', 'https']\n })\n .trim()\n\nexport const authoredAtSchema = Joi.date().iso().required()\nexport const authorIdSchema = Joi.string().trim().required()\nexport const authorDisplayNameSchema = Joi.string().trim().required()\n\nexport const formMetadataInputKeys = {\n title: titleSchema,\n organisation: organisationSchema,\n teamName: teamNameSchema,\n teamEmail: teamEmailSchema,\n privacyNoticeUrl: privacyNoticeUrlSchema\n}\n\n/**\n * Joi schema for `FormMetadataInput` interface\n * @see {@link FormMetadataInput}\n */\nexport const formMetadataInputSchema = Joi.object<FormMetadataInput>()\n .keys(formMetadataInputKeys)\n .required()\n\n/**\n * Joi schema for `FormMetadataAuthor` interface\n * @see {@link FormMetadataAuthor}\n */\nexport const formMetadataAuthorSchema = Joi.object<FormMetadataAuthor>()\n .keys({\n id: authorIdSchema,\n displayName: authorDisplayNameSchema\n })\n .required()\n\n/**\n * Joi schema for `FormMetadataState` interface\n * @see {@link FormMetadataState}\n */\nexport const formMetadataStateSchema = Joi.object<FormMetadataState>().keys({\n createdAt: authoredAtSchema,\n createdBy: formMetadataAuthorSchema,\n updatedAt: authoredAtSchema,\n updatedBy: formMetadataAuthorSchema\n})\n\n/**\n * Joi schema for `FormMetadata` interface\n * @see {@link FormMetadata}\n */\nexport const formMetadataSchema = formMetadataInputSchema.append<FormMetadata>({\n id: idSchema,\n slug: slugSchema,\n draft: formMetadataStateSchema,\n live: formMetadataStateSchema,\n createdAt: authoredAtSchema,\n createdBy: formMetadataAuthorSchema,\n updatedAt: authoredAtSchema,\n updatedBy: formMetadataAuthorSchema\n})\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AASrB,OAAO,MAAMC,aAAa,GAAG,CAC3B,uCAAuC,EACvC,mEAAmE,EACnE,OAAO,EACP,oBAAoB,EACpB,qBAAqB,EACrB,sCAAsC,EACtC,iBAAiB,EACjB,6BAA6B,EAC7B,wCAAwC,CACzC;AAED,OAAO,MAAMC,QAAQ,GAAGF,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,MAAM,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC;AAChE,OAAO,MAAMC,WAAW,GAAGP,GAAG,CAACG,MAAM,CAAC,CAAC,CAACK,GAAG,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAACH,QAAQ,CAAC,CAAC;AAClE,OAAO,MAAMI,UAAU,GAAGV,GAAG,CAACG,MAAM,CAAC,CAAC,CACnCQ,OAAO,CAAC,cAAc,EAAE;EAAEC,IAAI,EAAE;AAAoC,CAAC,CAAC,CACtEN,QAAQ,CAAC,CAAC;AAEb,OAAO,MAAMO,kBAAkB,GAAGb,GAAG,CAACG,MAAM,CAAC,CAAC,CAC3CW,KAAK,CAAC,GAAGb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B,QAAQ,CAAC,CAAC;;AAEb;AACA;AACA;AACA;AACA,OAAO,MAAM+B,wBAAwB,GAAGrC,GAAG,CAACmC,MAAM,CAAqB,CAAC,CACrEC,IAAI,CAAC;EACJE,EAAE,EAAEZ,cAAc;EAClBa,WAAW,EAAEZ;AACf,CAAC,CAAC,CACDrB,QAAQ,CAAC,CAAC;;AAEb;AACA;AACA;AACA;AACA,OAAO,MAAMkC,uBAAuB,GAAGxC,GAAG,CAACmC,MAAM,CAAoB,CAAC,CAACC,IAAI,CAAC;EAC1EK,SAAS,EAAElB,gBAAgB;EAC3BmB,SAAS,EAAEL,wBAAwB;EACnCM,SAAS,EAAEpB,gBAAgB;EAC3BqB,SAAS,EAAEP;AACb,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA,OAAO,MAAMQ,kBAAkB,GAAGX,uBAAuB,CAACY,MAAM,CAAe;EAC7ER,EAAE,EAAEpC,QAAQ;EACZ6C,IAAI,EAAErC,UAAU;EAChBsC,KAAK,EAAER,uBAAuB;EAC9BS,IAAI,EAAET,uBAAuB;EAC7BC,SAAS,EAAElB,gBAAgB;EAC3BmB,SAAS,EAAEL,wBAAwB;EACnCM,SAAS,EAAEpB,gBAAgB;EAC3BqB,SAAS,EAAEP;AACb,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["Joi","organisations","idSchema","string","hex","length","required","titleSchema","max","trim","slugSchema","pattern","name","organisationSchema","valid","teamNameSchema","teamEmailSchema","email","tlds","allow","privacyNoticeUrlSchema","uri","scheme","phoneSchema","emailAddressSchema","emailResponseTimeSchema","emailSchema","object","keys","address","responseTime","onlineUrlSchema","onlineTextSchema","onlineSchema","url","text","contactSchema","phone","online","authoredAtSchema","date","iso","authorIdSchema","authorDisplayNameSchema","formMetadataInputKeys","title","organisation","teamName","teamEmail","privacyNoticeUrl","contact","formMetadataInputSchema","formMetadataAuthorSchema","id","displayName","formMetadataStateSchema","createdAt","createdBy","updatedAt","updatedBy","formMetadataSchema","append","slug","draft","live"],"sources":["../../../../src/form/form-metadata/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport {\n type FormMetadata,\n type FormMetadataInput,\n type FormMetadataState,\n type FormMetadataAuthor,\n type FormMetadataContact,\n type FormMetadataContactOnline,\n type FormMetadataContactEmail\n} from '~/src/form/form-metadata/types.js'\n\nexport const organisations = [\n 'Animal and Plant Health Agency – APHA',\n 'Centre for Environment, Fisheries and Aquaculture Science – Cefas',\n 'Defra',\n 'Environment Agency',\n 'Forestry Commission',\n 'Marine Management Organisation – MMO',\n 'Natural England',\n 'Rural Payments Agency – RPA',\n 'Veterinary Medicines Directorate – VMD'\n]\n\nexport const idSchema = Joi.string().hex().length(24).required()\nexport const titleSchema = Joi.string().max(250).trim().required()\nexport const slugSchema = Joi.string()\n .pattern(/^[a-z0-9-]+$/, { name: 'letters, numbers and hyphens only' })\n .required()\n\nexport const organisationSchema = Joi.string()\n .valid(...organisations)\n .required()\n\nexport const teamNameSchema = Joi.string().max(100).trim().required()\nexport const teamEmailSchema = Joi.string()\n .email({ tlds: { allow: ['uk'] } })\n .trim()\n .required()\n\nexport const privacyNoticeUrlSchema = Joi.string()\n .uri({\n scheme: ['http', 'https']\n })\n .trim()\n\nexport const phoneSchema = Joi.string().trim()\n\nexport const emailAddressSchema = Joi.string().email().trim().required()\nexport const emailResponseTimeSchema = Joi.string().trim().required()\nexport const emailSchema = Joi.object<FormMetadataContactEmail>().keys({\n address: emailAddressSchema,\n responseTime: emailResponseTimeSchema\n})\n\nexport const onlineUrlSchema = Joi.string()\n .uri({\n scheme: ['http', 'https']\n })\n .trim()\n .required()\nexport const onlineTextSchema = Joi.string().trim().required()\nexport const onlineSchema = Joi.object<FormMetadataContactOnline>().keys({\n url: onlineUrlSchema,\n text: onlineTextSchema\n})\n\nexport const contactSchema = Joi.object<FormMetadataContact>().keys({\n phone: phoneSchema,\n email: emailSchema,\n online: onlineSchema\n})\n\nexport const authoredAtSchema = Joi.date().iso().required()\nexport const authorIdSchema = Joi.string().trim().required()\nexport const authorDisplayNameSchema = Joi.string().trim().required()\n\nexport const formMetadataInputKeys = {\n title: titleSchema,\n organisation: organisationSchema,\n teamName: teamNameSchema,\n teamEmail: teamEmailSchema,\n privacyNoticeUrl: privacyNoticeUrlSchema,\n contact: contactSchema\n}\n\n/**\n * Joi schema for `FormMetadataInput` interface\n * @see {@link FormMetadataInput}\n */\nexport const formMetadataInputSchema = Joi.object<FormMetadataInput>()\n .keys(formMetadataInputKeys)\n .required()\n\n/**\n * Joi schema for `FormMetadataAuthor` interface\n * @see {@link FormMetadataAuthor}\n */\nexport const formMetadataAuthorSchema = Joi.object<FormMetadataAuthor>()\n .keys({\n id: authorIdSchema,\n displayName: authorDisplayNameSchema\n })\n .required()\n\n/**\n * Joi schema for `FormMetadataState` interface\n * @see {@link FormMetadataState}\n */\nexport const formMetadataStateSchema = Joi.object<FormMetadataState>().keys({\n createdAt: authoredAtSchema,\n createdBy: formMetadataAuthorSchema,\n updatedAt: authoredAtSchema,\n updatedBy: formMetadataAuthorSchema\n})\n\n/**\n * Joi schema for `FormMetadata` interface\n * @see {@link FormMetadata}\n */\nexport const formMetadataSchema = formMetadataInputSchema.append<FormMetadata>({\n id: idSchema,\n slug: slugSchema,\n draft: formMetadataStateSchema,\n live: formMetadataStateSchema,\n createdAt: authoredAtSchema,\n createdBy: formMetadataAuthorSchema,\n updatedAt: authoredAtSchema,\n updatedBy: formMetadataAuthorSchema\n})\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAYrB,OAAO,MAAMC,aAAa,GAAG,CAC3B,uCAAuC,EACvC,mEAAmE,EACnE,OAAO,EACP,oBAAoB,EACpB,qBAAqB,EACrB,sCAAsC,EACtC,iBAAiB,EACjB,6BAA6B,EAC7B,wCAAwC,CACzC;AAED,OAAO,MAAMC,QAAQ,GAAGF,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,MAAM,CAAC,EAAE,CAAC,CAACC,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ErE,OAAO,MAAMsC,qBAAqB,GAAG;EACnCC,KAAK,EAAEtC,WAAW;EAClBuC,YAAY,EAAEjC,kBAAkB;EAChCkC,QAAQ,EAAEhC,cAAc;EACxBiC,SAAS,EAAEhC,eAAe;EAC1BiC,gBAAgB,EAAE7B,sBAAsB;EACxC8B,OAAO,EAAEd;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMe,uBAAuB,GAAGnD,GAAG,CAAC2B,MAAM,CAAoB,CAAC,CACnEC,IAAI,CAACgB,qBAAqB,CAAC,CAC3BtC,QAAQ,CAAC,CAAC;;AAEb;AACA;AACA;AACA;AACA,OAAO,MAAM8C,wBAAwB,GAAGpD,GAAG,CAAC2B,MAAM,CAAqB,CAAC,CACrEC,IAAI,CAAC;EACJyB,EAAE,EAAEX,cAAc;EAClBY,WAAW,EAAEX;AACf,CAAC,CAAC,CACDrC,QAAQ,CAAC,CAAC;;AAEb;AACA;AACA;AACA;AACA,OAAO,MAAMiD,uBAAuB,GAAGvD,GAAG,CAAC2B,MAAM,CAAoB,CAAC,CAACC,IAAI,CAAC;EAC1E4B,SAAS,EAAEjB,gBAAgB;EAC3BkB,SAAS,EAAEL,wBAAwB;EACnCM,SAAS,EAAEnB,gBAAgB;EAC3BoB,SAAS,EAAEP;AACb,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA,OAAO,MAAMQ,kBAAkB,GAAGT,uBAAuB,CAACU,MAAM,CAAe;EAC7ER,EAAE,EAAEnD,QAAQ;EACZ4D,IAAI,EAAEpD,UAAU;EAChBqD,KAAK,EAAER,uBAAuB;EAC9BS,IAAI,EAAET,uBAAuB;EAC7BC,SAAS,EAAEjB,gBAAgB;EAC3BkB,SAAS,EAAEL,wBAAwB;EACnCM,SAAS,EAAEnB,gBAAgB;EAC3BoB,SAAS,EAAEP;AACb,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-metadata/types.ts"],"sourcesContent":["import { formMetadataSchema } from '~/src/form/form-metadata/index.js'\n\n/**\n * Interface for author (createdBy and updatedBy)\n */\nexport interface FormMetadataAuthor {\n /**\n * The ID of the user\n */\n id: string\n\n /**\n * The display name of the user\n */\n displayName: string\n}\n\n/**\n * Interface for metadata state (draft & live)\n */\nexport interface FormMetadataState {\n /**\n * The date the form state was created\n */\n createdAt: Date\n\n /**\n * The author who created the state\n */\n createdBy: FormMetadataAuthor\n\n /**\n * The date the form state was last updated\n */\n updatedAt: Date\n\n /**\n * The author who last updated the state\n */\n updatedBy: FormMetadataAuthor\n}\n\n/**\n * Interface for `formMetadataSchema` Joi schema\n * @see {@link formMetadataSchema}\n */\nexport interface FormMetadata {\n /**\n * The id of the form\n */\n id: string\n\n /**\n * The human-readable slug id of the form\n */\n slug: string\n\n /**\n * The human-readable title of the form\n */\n title: string\n\n /**\n * The organisation this form belongs to\n */\n organisation: string\n\n /**\n * The name of the team who own this form\n */\n teamName: string\n\n /**\n * The email of the team who own this form\n */\n teamEmail: string\n\n /**\n * The url of the privacy notice\n */\n privacyNoticeUrl?: string\n\n /**\n * The draft state of the form\n */\n draft?: FormMetadataState\n\n /**\n * The live state of the form\n */\n live?: FormMetadataState\n\n /**\n * The author who created the form\n */\n createdBy: FormMetadataState['createdBy']\n\n /**\n * The date the form was created\n */\n createdAt: FormMetadataState['createdAt']\n\n /**\n * The author who last updated the form\n */\n updatedBy: FormMetadataState['updatedBy']\n\n /**\n * The date the form was last updated\n */\n updatedAt: FormMetadataState['updatedAt']\n}\n\nexport type FormByIdInput = Pick<FormMetadata, 'id'>\nexport type FormBySlugInput = Pick<FormMetadata, 'slug'>\nexport type FormMetadataDocument = Omit<FormMetadata, 'id'>\nexport type FormMetadataInput = Pick<\n FormMetadata,\n 'title' | 'organisation' | 'teamName' | 'teamEmail' | 'privacyNoticeUrl'\n>\n\nexport interface FormResponse {\n id: FormMetadata['id']\n slug: FormMetadata['slug']\n status: string\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-metadata/types.ts"],"sourcesContent":["import { formMetadataSchema } from '~/src/form/form-metadata/index.js'\n\n/**\n * Interface for author (createdBy and updatedBy)\n */\nexport interface FormMetadataAuthor {\n /**\n * The ID of the user\n */\n id: string\n\n /**\n * The display name of the user\n */\n displayName: string\n}\n\n/**\n * Interface for metadata state (draft & live)\n */\nexport interface FormMetadataState {\n /**\n * The date the form state was created\n */\n createdAt: Date\n\n /**\n * The author who created the state\n */\n createdBy: FormMetadataAuthor\n\n /**\n * The date the form state was last updated\n */\n updatedAt: Date\n\n /**\n * The author who last updated the state\n */\n updatedBy: FormMetadataAuthor\n}\n\n/**\n * Interface for email contact details\n */\nexport interface FormMetadataContactEmail {\n /**\n * The email address details for support\n */\n address: string\n\n /**\n * How long it takes to receive a support response\n */\n responseTime: string\n}\n\n/**\n * Interface for online contact details\n */\nexport interface FormMetadataContactOnline {\n /**\n * The url of the online contact link\n */\n url: string\n\n /**\n * The text of the online contact link\n */\n text: string\n}\n\n/**\n * Interface for contact details (phone, email and online)\n */\nexport interface FormMetadataContact {\n /**\n * The phone details for support\n */\n phone?: string\n\n /**\n * The email details for support\n */\n email?: FormMetadataContactEmail\n\n /**\n * The online details for support\n */\n online?: FormMetadataContactOnline\n}\n\n/**\n * Interface for `formMetadataSchema` Joi schema\n * @see {@link formMetadataSchema}\n */\nexport interface FormMetadata {\n /**\n * The id of the form\n */\n id: string\n\n /**\n * The human-readable slug id of the form\n */\n slug: string\n\n /**\n * The human-readable title of the form\n */\n title: string\n\n /**\n * The organisation this form belongs to\n */\n organisation: string\n\n /**\n * The name of the team who own this form\n */\n teamName: string\n\n /**\n * The email of the team who own this form\n */\n teamEmail: string\n\n /**\n * The url of the privacy notice\n */\n privacyNoticeUrl?: string\n\n /**\n * The contact details of the form\n */\n contact?: FormMetadataContact\n\n /**\n * The draft state of the form\n */\n draft?: FormMetadataState\n\n /**\n * The live state of the form\n */\n live?: FormMetadataState\n\n /**\n * The author who created the form\n */\n createdBy: FormMetadataState['createdBy']\n\n /**\n * The date the form was created\n */\n createdAt: FormMetadataState['createdAt']\n\n /**\n * The author who last updated the form\n */\n updatedBy: FormMetadataState['updatedBy']\n\n /**\n * The date the form was last updated\n */\n updatedAt: FormMetadataState['updatedAt']\n}\n\nexport type FormByIdInput = Pick<FormMetadata, 'id'>\nexport type FormBySlugInput = Pick<FormMetadata, 'slug'>\nexport type FormMetadataDocument = Omit<FormMetadata, 'id'>\nexport type FormMetadataInput = Pick<\n FormMetadata,\n | 'title'\n | 'organisation'\n | 'teamName'\n | 'teamEmail'\n | 'privacyNoticeUrl'\n | 'contact'\n>\n\nexport interface FormResponse {\n id: FormMetadata['id']\n slug: FormMetadata['slug']\n status: string\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import Joi from 'joi';
2
- import { type FormMetadata, type FormMetadataInput, type FormMetadataState, type FormMetadataAuthor } from '../../form/form-metadata/types.js';
2
+ import { type FormMetadata, type FormMetadataInput, type FormMetadataState, type FormMetadataAuthor, type FormMetadataContact, type FormMetadataContactOnline, type FormMetadataContactEmail } from '../../form/form-metadata/types.js';
3
3
  export declare const organisations: string[];
4
4
  export declare const idSchema: Joi.StringSchema<string>;
5
5
  export declare const titleSchema: Joi.StringSchema<string>;
@@ -8,6 +8,14 @@ export declare const organisationSchema: Joi.StringSchema<string>;
8
8
  export declare const teamNameSchema: Joi.StringSchema<string>;
9
9
  export declare const teamEmailSchema: Joi.StringSchema<string>;
10
10
  export declare const privacyNoticeUrlSchema: Joi.StringSchema<string>;
11
+ export declare const phoneSchema: Joi.StringSchema<string>;
12
+ export declare const emailAddressSchema: Joi.StringSchema<string>;
13
+ export declare const emailResponseTimeSchema: Joi.StringSchema<string>;
14
+ export declare const emailSchema: Joi.ObjectSchema<FormMetadataContactEmail>;
15
+ export declare const onlineUrlSchema: Joi.StringSchema<string>;
16
+ export declare const onlineTextSchema: Joi.StringSchema<string>;
17
+ export declare const onlineSchema: Joi.ObjectSchema<FormMetadataContactOnline>;
18
+ export declare const contactSchema: Joi.ObjectSchema<FormMetadataContact>;
11
19
  export declare const authoredAtSchema: Joi.DateSchema<Date>;
12
20
  export declare const authorIdSchema: Joi.StringSchema<string>;
13
21
  export declare const authorDisplayNameSchema: Joi.StringSchema<string>;
@@ -17,6 +25,7 @@ export declare const formMetadataInputKeys: {
17
25
  teamName: Joi.StringSchema<string>;
18
26
  teamEmail: Joi.StringSchema<string>;
19
27
  privacyNoticeUrl: Joi.StringSchema<string>;
28
+ contact: Joi.ObjectSchema<FormMetadataContact>;
20
29
  };
21
30
  /**
22
31
  * Joi schema for `FormMetadataInput` interface
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAErB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,mCAAmC,CAAA;AAE1C,eAAO,MAAM,aAAa,UAUzB,CAAA;AAED,eAAO,MAAM,QAAQ,0BAA2C,CAAA;AAChE,eAAO,MAAM,WAAW,0BAA0C,CAAA;AAClE,eAAO,MAAM,UAAU,0BAEV,CAAA;AAEb,eAAO,MAAM,kBAAkB,0BAElB,CAAA;AAEb,eAAO,MAAM,cAAc,0BAA0C,CAAA;AACrE,eAAO,MAAM,eAAe,0BAGf,CAAA;AAEb,eAAO,MAAM,sBAAsB,0BAI1B,CAAA;AAET,eAAO,MAAM,gBAAgB,sBAA8B,CAAA;AAC3D,eAAO,MAAM,cAAc,0BAAiC,CAAA;AAC5D,eAAO,MAAM,uBAAuB,0BAAiC,CAAA;AAErE,eAAO,MAAM,qBAAqB;;;;;;CAMjC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,qCAEvB,CAAA;AAEb;;;GAGG;AACH,eAAO,MAAM,wB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AACH,eAAO,MAAM,uBAAuB,qCAEvB,CAAA;AAEb;;;GAGG;AACH,eAAO,MAAM,wBAAwB,sCAKxB,CAAA;AAEb;;;GAGG;AACH,eAAO,MAAM,uBAAuB,qCAKlC,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,gCAS7B,CAAA"}
@@ -32,6 +32,49 @@ export interface FormMetadataState {
32
32
  */
33
33
  updatedBy: FormMetadataAuthor;
34
34
  }
35
+ /**
36
+ * Interface for email contact details
37
+ */
38
+ export interface FormMetadataContactEmail {
39
+ /**
40
+ * The email address details for support
41
+ */
42
+ address: string;
43
+ /**
44
+ * How long it takes to receive a support response
45
+ */
46
+ responseTime: string;
47
+ }
48
+ /**
49
+ * Interface for online contact details
50
+ */
51
+ export interface FormMetadataContactOnline {
52
+ /**
53
+ * The url of the online contact link
54
+ */
55
+ url: string;
56
+ /**
57
+ * The text of the online contact link
58
+ */
59
+ text: string;
60
+ }
61
+ /**
62
+ * Interface for contact details (phone, email and online)
63
+ */
64
+ export interface FormMetadataContact {
65
+ /**
66
+ * The phone details for support
67
+ */
68
+ phone?: string;
69
+ /**
70
+ * The email details for support
71
+ */
72
+ email?: FormMetadataContactEmail;
73
+ /**
74
+ * The online details for support
75
+ */
76
+ online?: FormMetadataContactOnline;
77
+ }
35
78
  /**
36
79
  * Interface for `formMetadataSchema` Joi schema
37
80
  * @see {@link formMetadataSchema}
@@ -65,6 +108,10 @@ export interface FormMetadata {
65
108
  * The url of the privacy notice
66
109
  */
67
110
  privacyNoticeUrl?: string;
111
+ /**
112
+ * The contact details of the form
113
+ */
114
+ contact?: FormMetadataContact;
68
115
  /**
69
116
  * The draft state of the form
70
117
  */
@@ -93,7 +140,7 @@ export interface FormMetadata {
93
140
  export type FormByIdInput = Pick<FormMetadata, 'id'>;
94
141
  export type FormBySlugInput = Pick<FormMetadata, 'slug'>;
95
142
  export type FormMetadataDocument = Omit<FormMetadata, 'id'>;
96
- export type FormMetadataInput = Pick<FormMetadata, 'title' | 'organisation' | 'teamName' | 'teamEmail' | 'privacyNoticeUrl'>;
143
+ export type FormMetadataInput = Pick<FormMetadata, 'title' | 'organisation' | 'teamName' | 'teamEmail' | 'privacyNoticeUrl' | 'contact'>;
97
144
  export interface FormResponse {
98
145
  id: FormMetadata['id'];
99
146
  slug: FormMetadata['slug'];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-metadata/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,SAAS,EAAE,IAAI,CAAA;IAEf;;OAEG;IACH,SAAS,EAAE,kBAAkB,CAAA;IAE7B;;OAEG;IACH,SAAS,EAAE,IAAI,CAAA;IAEf;;OAEG;IACH,SAAS,EAAE,kBAAkB,CAAA;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAA;IAEzB;;OAEG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAA;IAExB;;OAEG;IACH,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAA;IAEzC;;OAEG;IACH,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAA;IAEzC;;O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IAAI,CAAC,CAAA;AAC3D,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,YAAY,EACV,OAAO,GACP,cAAc,GACd,UAAU,GACV,WAAW,GACX,kBAAkB,GAClB,SAAS,CACZ,CAAA;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;IACtB,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAA;IAC1B,MAAM,EAAE,MAAM,CAAA;CACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.316",
3
+ "version": "3.0.317",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
6
6
  "repository": {
@@ -4,7 +4,10 @@ import {
4
4
  type FormMetadata,
5
5
  type FormMetadataInput,
6
6
  type FormMetadataState,
7
- type FormMetadataAuthor
7
+ type FormMetadataAuthor,
8
+ type FormMetadataContact,
9
+ type FormMetadataContactOnline,
10
+ type FormMetadataContactEmail
8
11
  } from '~/src/form/form-metadata/types.js'
9
12
 
10
13
  export const organisations = [
@@ -41,6 +44,33 @@ export const privacyNoticeUrlSchema = Joi.string()
41
44
  })
42
45
  .trim()
43
46
 
47
+ export const phoneSchema = Joi.string().trim()
48
+
49
+ export const emailAddressSchema = Joi.string().email().trim().required()
50
+ export const emailResponseTimeSchema = Joi.string().trim().required()
51
+ export const emailSchema = Joi.object<FormMetadataContactEmail>().keys({
52
+ address: emailAddressSchema,
53
+ responseTime: emailResponseTimeSchema
54
+ })
55
+
56
+ export const onlineUrlSchema = Joi.string()
57
+ .uri({
58
+ scheme: ['http', 'https']
59
+ })
60
+ .trim()
61
+ .required()
62
+ export const onlineTextSchema = Joi.string().trim().required()
63
+ export const onlineSchema = Joi.object<FormMetadataContactOnline>().keys({
64
+ url: onlineUrlSchema,
65
+ text: onlineTextSchema
66
+ })
67
+
68
+ export const contactSchema = Joi.object<FormMetadataContact>().keys({
69
+ phone: phoneSchema,
70
+ email: emailSchema,
71
+ online: onlineSchema
72
+ })
73
+
44
74
  export const authoredAtSchema = Joi.date().iso().required()
45
75
  export const authorIdSchema = Joi.string().trim().required()
46
76
  export const authorDisplayNameSchema = Joi.string().trim().required()
@@ -50,7 +80,8 @@ export const formMetadataInputKeys = {
50
80
  organisation: organisationSchema,
51
81
  teamName: teamNameSchema,
52
82
  teamEmail: teamEmailSchema,
53
- privacyNoticeUrl: privacyNoticeUrlSchema
83
+ privacyNoticeUrl: privacyNoticeUrlSchema,
84
+ contact: contactSchema
54
85
  }
55
86
 
56
87
  /**
@@ -40,6 +40,56 @@ export interface FormMetadataState {
40
40
  updatedBy: FormMetadataAuthor
41
41
  }
42
42
 
43
+ /**
44
+ * Interface for email contact details
45
+ */
46
+ export interface FormMetadataContactEmail {
47
+ /**
48
+ * The email address details for support
49
+ */
50
+ address: string
51
+
52
+ /**
53
+ * How long it takes to receive a support response
54
+ */
55
+ responseTime: string
56
+ }
57
+
58
+ /**
59
+ * Interface for online contact details
60
+ */
61
+ export interface FormMetadataContactOnline {
62
+ /**
63
+ * The url of the online contact link
64
+ */
65
+ url: string
66
+
67
+ /**
68
+ * The text of the online contact link
69
+ */
70
+ text: string
71
+ }
72
+
73
+ /**
74
+ * Interface for contact details (phone, email and online)
75
+ */
76
+ export interface FormMetadataContact {
77
+ /**
78
+ * The phone details for support
79
+ */
80
+ phone?: string
81
+
82
+ /**
83
+ * The email details for support
84
+ */
85
+ email?: FormMetadataContactEmail
86
+
87
+ /**
88
+ * The online details for support
89
+ */
90
+ online?: FormMetadataContactOnline
91
+ }
92
+
43
93
  /**
44
94
  * Interface for `formMetadataSchema` Joi schema
45
95
  * @see {@link formMetadataSchema}
@@ -80,6 +130,11 @@ export interface FormMetadata {
80
130
  */
81
131
  privacyNoticeUrl?: string
82
132
 
133
+ /**
134
+ * The contact details of the form
135
+ */
136
+ contact?: FormMetadataContact
137
+
83
138
  /**
84
139
  * The draft state of the form
85
140
  */
@@ -116,7 +171,12 @@ export type FormBySlugInput = Pick<FormMetadata, 'slug'>
116
171
  export type FormMetadataDocument = Omit<FormMetadata, 'id'>
117
172
  export type FormMetadataInput = Pick<
118
173
  FormMetadata,
119
- 'title' | 'organisation' | 'teamName' | 'teamEmail' | 'privacyNoticeUrl'
174
+ | 'title'
175
+ | 'organisation'
176
+ | 'teamName'
177
+ | 'teamEmail'
178
+ | 'privacyNoticeUrl'
179
+ | 'contact'
120
180
  >
121
181
 
122
182
  export interface FormResponse {