@defra/forms-model 3.0.74 → 3.0.75

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.
@@ -1,6 +1,7 @@
1
1
  import Joi from 'joi';
2
+ export const organisations = ['Animal and Plant Health Agency – APHA', 'Centre for Environment, Fisheries and Aquaculture Science – Cefas', 'Defra', 'Environment Agency', 'Forestry Commission', 'Marine Management Organisation – MMO', 'Natural England', 'Rural Payments Agency – RPA', 'Veterinary Medicines Directorate – VMD'];
2
3
  export const titleSchema = Joi.string().max(250).trim().required();
3
- export const organisationSchema = Joi.string().max(100).trim().required();
4
+ export const organisationSchema = Joi.string().valid(...organisations).required();
4
5
  export const teamNameSchema = Joi.string().max(100).trim().required();
5
6
  export const teamEmailSchema = Joi.string().email({
6
7
  tlds: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Joi","titleSchema","string","max","trim","required","organisationSchema","teamNameSchema","teamEmailSchema","email","tlds","allow","formMetadataSchema","object","keys","title","organisation","teamName","teamEmail"],"sources":["../../../../src/form/form-metadata/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport { type FormMetadata } from '~/src/form/form-metadata/types.js'\n\nexport const titleSchema = Joi.string().max(250).trim().required()\nexport const organisationSchema = Joi.string().max(100).trim().required()\nexport const teamNameSchema = Joi.string().max(100).trim().required()\nexport const teamEmailSchema = Joi.string()\n .email({ tlds: { allow: ['uk'] } })\n .trim()\n .required()\n\n/**\n * Joi schema for `FormMetadata` interface\n * @see {@link FormMetadata}\n */\nexport const formMetadataSchema = Joi.object<FormMetadata>()\n .keys({\n title: titleSchema,\n organisation: organisationSchema,\n teamName: teamNameSchema,\n teamEmail: teamEmailSchema\n })\n .required()\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAIrB,OAAO,MAAMC,WAAW,GAAGD,GAAG,CAACE,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;AAClE,OAAO,MAAMC,kBAAkB,GAAGN,GAAG,CAACE,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;AACzE,OAAO,MAAME,cAAc,GAAGP,GAAG,CAACE,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;AACrE,OAAO,MAAMG,eAAe,GAAGR,GAAG,CAACE,MAAM,CAAC,CAAC,CACxCO,KAAK,CAAC;EAAEC,IAAI,EAAE;IAAEC,KAAK,EAAE,CAAC,IAAI;EAAE;AAAE,CAAC,CAAC,CAClCP,IAAI,CAAC,CAAC,CACNC,QAAQ,CAAC,CAAC;;AAEb;AACA;AACA;AACA;AACA,OAAO,MAAMO,kBAAkB,GAAGZ,GAAG,CAACa,MAAM,CAAe,CAAC,CACzDC,IAAI,CAAC;EACJC,KAAK,EAAEd,WAAW;EAClBe,YAAY,EAAEV,kBAAkB;EAChCW,QAAQ,EAAEV,cAAc;EACxBW,SAAS,EAAEV;AACb,CAAC,CAAC,CACDH,QAAQ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["Joi","organisations","titleSchema","string","max","trim","required","organisationSchema","valid","teamNameSchema","teamEmailSchema","email","tlds","allow","formMetadataSchema","object","keys","title","organisation","teamName","teamEmail"],"sources":["../../../../src/form/form-metadata/index.ts"],"sourcesContent":["import Joi from 'joi'\n\nimport { type FormMetadata } 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 titleSchema = Joi.string().max(250).trim().required()\nexport const organisationSchema = Joi.string()\n .valid(...organisations)\n .required()\nexport const teamNameSchema = Joi.string().max(100).trim().required()\nexport const teamEmailSchema = Joi.string()\n .email({ tlds: { allow: ['uk'] } })\n .trim()\n .required()\n\n/**\n * Joi schema for `FormMetadata` interface\n * @see {@link FormMetadata}\n */\nexport const formMetadataSchema = Joi.object<FormMetadata>()\n .keys({\n title: titleSchema,\n organisation: organisationSchema,\n teamName: teamNameSchema,\n teamEmail: teamEmailSchema\n })\n .required()\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAIrB,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,WAAW,GAAGF,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;AAClE,OAAO,MAAMC,kBAAkB,GAAGP,GAAG,CAACG,MAAM,CAAC,CAAC,CAC3CK,KAAK,CAAC,GAAGP,aAAa,CAAC,CACvBK,QAAQ,CAAC,CAAC;AACb,OAAO,MAAMG,cAAc,GAAGT,GAAG,CAACG,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;AACrE,OAAO,MAAMI,eAAe,GAAGV,GAAG,CAACG,MAAM,CAAC,CAAC,CACxCQ,KAAK,CAAC;EAAEC,IAAI,EAAE;IAAEC,KAAK,EAAE,CAAC,IAAI;EAAE;AAAE,CAAC,CAAC,CAClCR,IAAI,CAAC,CAAC,CACNC,QAAQ,CAAC,CAAC;;AAEb;AACA;AACA;AACA;AACA,OAAO,MAAMQ,kBAAkB,GAAGd,GAAG,CAACe,MAAM,CAAe,CAAC,CACzDC,IAAI,CAAC;EACJC,KAAK,EAAEf,WAAW;EAClBgB,YAAY,EAAEX,kBAAkB;EAChCY,QAAQ,EAAEV,cAAc;EACxBW,SAAS,EAAEV;AACb,CAAC,CAAC,CACDJ,QAAQ,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import Joi from 'joi';
2
2
  import { type FormMetadata } from '../../form/form-metadata/types.js';
3
+ export declare const organisations: string[];
3
4
  export declare const titleSchema: Joi.StringSchema<string>;
4
5
  export declare const organisationSchema: Joi.StringSchema<string>;
5
6
  export declare const teamNameSchema: Joi.StringSchema<string>;
@@ -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,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAErE,eAAO,MAAM,WAAW,0BAA0C,CAAA;AAClE,eAAO,MAAM,kBAAkB,0BAA0C,CAAA;AACzE,eAAO,MAAM,cAAc,0BAA0C,CAAA;AACrE,eAAO,MAAM,eAAe,0BAGf,CAAA;AAEb;;;GAGG;AACH,eAAO,MAAM,kBAAkB,gCAOlB,CAAA"}
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,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAErE,eAAO,MAAM,aAAa,UAUzB,CAAA;AAED,eAAO,MAAM,WAAW,0BAA0C,CAAA;AAClE,eAAO,MAAM,kBAAkB,0BAElB,CAAA;AACb,eAAO,MAAM,cAAc,0BAA0C,CAAA;AACrE,eAAO,MAAM,eAAe,0BAGf,CAAA;AAEb;;;GAGG;AACH,eAAO,MAAM,kBAAkB,gCAOlB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.74",
3
+ "version": "3.0.75",
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": {
@@ -2,8 +2,22 @@ import Joi from 'joi'
2
2
 
3
3
  import { type FormMetadata } from '~/src/form/form-metadata/types.js'
4
4
 
5
+ export const organisations = [
6
+ 'Animal and Plant Health Agency – APHA',
7
+ 'Centre for Environment, Fisheries and Aquaculture Science – Cefas',
8
+ 'Defra',
9
+ 'Environment Agency',
10
+ 'Forestry Commission',
11
+ 'Marine Management Organisation – MMO',
12
+ 'Natural England',
13
+ 'Rural Payments Agency – RPA',
14
+ 'Veterinary Medicines Directorate – VMD'
15
+ ]
16
+
5
17
  export const titleSchema = Joi.string().max(250).trim().required()
6
- export const organisationSchema = Joi.string().max(100).trim().required()
18
+ export const organisationSchema = Joi.string()
19
+ .valid(...organisations)
20
+ .required()
7
21
  export const teamNameSchema = Joi.string().max(100).trim().required()
8
22
  export const teamEmailSchema = Joi.string()
9
23
  .email({ tlds: { allow: ['uk'] } })