@defra/forms-model 3.0.72 → 3.0.73
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-metadata/index.js +13 -8
- package/dist/module/form/form-metadata/index.js.map +1 -1
- package/dist/types/form/form-metadata/index.d.ts +4 -0
- package/dist/types/form/form-metadata/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/form/form-metadata/index.ts +12 -7
@@ -1,16 +1,21 @@
|
|
1
1
|
import Joi from 'joi';
|
2
|
+
export const titleSchema = Joi.string().max(250).trim().required();
|
3
|
+
export const organisationSchema = Joi.string().max(100).trim().required();
|
4
|
+
export const teamNameSchema = Joi.string().max(100).trim().required();
|
5
|
+
export const teamEmailSchema = Joi.string().email({
|
6
|
+
tlds: {
|
7
|
+
allow: ['uk']
|
8
|
+
}
|
9
|
+
}).trim().required();
|
10
|
+
|
2
11
|
/**
|
3
12
|
* Joi schema for `FormMetadata` interface
|
4
13
|
* @see {@link FormMetadata}
|
5
14
|
*/
|
6
15
|
export const formMetadataSchema = Joi.object().keys({
|
7
|
-
title:
|
8
|
-
organisation:
|
9
|
-
teamName:
|
10
|
-
teamEmail:
|
11
|
-
tlds: {
|
12
|
-
allow: ['uk']
|
13
|
-
}
|
14
|
-
}).trim().required()
|
16
|
+
title: titleSchema,
|
17
|
+
organisation: organisationSchema,
|
18
|
+
teamName: teamNameSchema,
|
19
|
+
teamEmail: teamEmailSchema
|
15
20
|
}).required();
|
16
21
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["Joi","
|
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,5 +1,9 @@
|
|
1
1
|
import Joi from 'joi';
|
2
2
|
import { type FormMetadata } from '../../form/form-metadata/types.js';
|
3
|
+
export declare const titleSchema: Joi.StringSchema<string>;
|
4
|
+
export declare const organisationSchema: Joi.StringSchema<string>;
|
5
|
+
export declare const teamNameSchema: Joi.StringSchema<string>;
|
6
|
+
export declare const teamEmailSchema: Joi.StringSchema<string>;
|
3
7
|
/**
|
4
8
|
* Joi schema for `FormMetadata` interface
|
5
9
|
* @see {@link FormMetadata}
|
@@ -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;;;GAGG;AACH,eAAO,MAAM,kBAAkB,
|
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"}
|
package/package.json
CHANGED
@@ -2,18 +2,23 @@ import Joi from 'joi'
|
|
2
2
|
|
3
3
|
import { type FormMetadata } from '~/src/form/form-metadata/types.js'
|
4
4
|
|
5
|
+
export const titleSchema = Joi.string().max(250).trim().required()
|
6
|
+
export const organisationSchema = Joi.string().max(100).trim().required()
|
7
|
+
export const teamNameSchema = Joi.string().max(100).trim().required()
|
8
|
+
export const teamEmailSchema = Joi.string()
|
9
|
+
.email({ tlds: { allow: ['uk'] } })
|
10
|
+
.trim()
|
11
|
+
.required()
|
12
|
+
|
5
13
|
/**
|
6
14
|
* Joi schema for `FormMetadata` interface
|
7
15
|
* @see {@link FormMetadata}
|
8
16
|
*/
|
9
17
|
export const formMetadataSchema = Joi.object<FormMetadata>()
|
10
18
|
.keys({
|
11
|
-
title:
|
12
|
-
organisation:
|
13
|
-
teamName:
|
14
|
-
teamEmail:
|
15
|
-
.email({ tlds: { allow: ['uk'] } })
|
16
|
-
.trim()
|
17
|
-
.required()
|
19
|
+
title: titleSchema,
|
20
|
+
organisation: organisationSchema,
|
21
|
+
teamName: teamNameSchema,
|
22
|
+
teamEmail: teamEmailSchema
|
18
23
|
})
|
19
24
|
.required()
|