@planning-inspectorate/dynamic-forms 3.12.0 → 3.13.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planning-inspectorate/dynamic-forms",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "description": "This package is for building GDS forms using a configuration-based approach.",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -13,6 +13,19 @@ export class BaseValidator {
13
13
  throw new Error("Abstract classes can't be instantiated.");
14
14
  }
15
15
  }
16
+
17
+ /**
18
+ * Validates response body against field validators.
19
+ * Subclasses must override this method.
20
+ * @abstract
21
+ * @param {import('../questions/question-props.js').QuestionProps} questionObj - The question object containing the fieldName to validate.
22
+ * @param {import('../journey/journey-response.js').JourneyResponse} [journeyResponse] - The current journey response (optional).
23
+ * @returns {import('express-validator').ValidationChain | import('express-validator').ValidationChain[]}
24
+ */
25
+ // eslint-disable-next-line no-unused-vars
26
+ validate(questionObj, journeyResponse) {
27
+ throw new Error('validate method must be implemented by subclass');
28
+ }
16
29
  }
17
30
 
18
31
  export default BaseValidator;
@@ -7,6 +7,15 @@ export class BaseValidator {
7
7
  * @type {string} error message to display to user
8
8
  */
9
9
  errorMessage: string;
10
+ /**
11
+ * Validates response body against field validators.
12
+ * Subclasses must override this method.
13
+ * @abstract
14
+ * @param {import('../questions/question-props.js').QuestionProps} questionObj - The question object containing the fieldName to validate.
15
+ * @param {import('../journey/journey-response.js').JourneyResponse} [journeyResponse] - The current journey response (optional).
16
+ * @returns {import('express-validator').ValidationChain | import('express-validator').ValidationChain[]}
17
+ */
18
+ validate(questionObj: import("../questions/question-props.js").QuestionProps, journeyResponse?: import("../journey/journey-response.js").JourneyResponse): import("express-validator").ValidationChain | import("express-validator").ValidationChain[];
10
19
  }
11
20
  export default BaseValidator;
12
21
  //# sourceMappingURL=base-validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/base-validator.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IACC;;OAEG;IACH,cAFU,MAAM,CAEH;CAOb"}
1
+ {"version":3,"file":"base-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/base-validator.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IACC;;OAEG;IACH,cAFU,MAAM,CAEH;IAQb;;;;;;;OAOG;IAEH,sBALW,OAAO,gCAAgC,EAAE,aAAa,oBACtD,OAAO,gCAAgC,EAAE,eAAe,GACtD,OAAO,mBAAmB,EAAE,eAAe,GAAG,OAAO,mBAAmB,EAAE,eAAe,EAAE,CAKvG;CACD"}