@planning-inspectorate/dynamic-forms 3.10.10 → 3.10.12
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 +1 -1
- package/src/questions/question.js +3 -3
- package/src/section.js +2 -2
- package/types/commitlint.config.d.ts +7 -0
- package/types/commitlint.config.d.ts.map +1 -0
- package/types/eslint.config.d.ts +95 -0
- package/types/eslint.config.d.ts.map +1 -0
- package/types/move-types.d.ts +2 -0
- package/types/move-types.d.ts.map +1 -0
- package/types/src/components/address/question.d.ts +36 -0
- package/types/src/components/address/question.d.ts.map +1 -0
- package/types/src/components/boolean/question.d.ts +52 -0
- package/types/src/components/boolean/question.d.ts.map +1 -0
- package/types/src/components/checkbox/question.d.ts +52 -0
- package/types/src/components/checkbox/question.d.ts.map +1 -0
- package/types/src/components/date/question.d.ts +23 -0
- package/types/src/components/date/question.d.ts.map +1 -0
- package/types/src/components/date-period/question.d.ts +35 -0
- package/types/src/components/date-period/question.d.ts.map +1 -0
- package/types/src/components/date-time/question.d.ts +25 -0
- package/types/src/components/date-time/question.d.ts.map +1 -0
- package/types/src/components/email/question.d.ts +31 -0
- package/types/src/components/email/question.d.ts.map +1 -0
- package/types/src/components/identifier/question.d.ts +16 -0
- package/types/src/components/identifier/question.d.ts.map +1 -0
- package/types/src/components/manage-list/manage-list-actions.d.ts +10 -0
- package/types/src/components/manage-list/manage-list-actions.d.ts.map +1 -0
- package/types/src/components/manage-list/manage-list-section.d.ts +16 -0
- package/types/src/components/manage-list/manage-list-section.d.ts.map +1 -0
- package/types/src/components/manage-list/question.d.ts +49 -0
- package/types/src/components/manage-list/question.d.ts.map +1 -0
- package/types/src/components/manage-list/utils.d.ts +18 -0
- package/types/src/components/manage-list/utils.d.ts.map +1 -0
- package/types/src/components/multi-field-input/question.d.ts +61 -0
- package/types/src/components/multi-field-input/question.d.ts.map +1 -0
- package/types/src/components/number-entry/question.d.ts +38 -0
- package/types/src/components/number-entry/question.d.ts.map +1 -0
- package/types/src/components/radio/question.d.ts +58 -0
- package/types/src/components/radio/question.d.ts.map +1 -0
- package/types/src/components/select/question.d.ts +55 -0
- package/types/src/components/select/question.d.ts.map +1 -0
- package/types/src/components/single-line-input/question.d.ts +19 -0
- package/types/src/components/single-line-input/question.d.ts.map +1 -0
- package/types/src/components/text-entry/question.d.ts +35 -0
- package/types/src/components/text-entry/question.d.ts.map +1 -0
- package/types/src/components/text-entry-redact/question.d.ts +35 -0
- package/types/src/components/text-entry-redact/question.d.ts.map +1 -0
- package/types/src/components/unit-option-entry/question.d.ts +84 -0
- package/types/src/components/unit-option-entry/question.d.ts.map +1 -0
- package/types/src/components/utils/component-types.d.ts +19 -0
- package/types/src/components/utils/component-types.d.ts.map +1 -0
- package/types/src/components/utils/persisted-number-answer.d.ts +2 -0
- package/types/src/components/utils/persisted-number-answer.d.ts.map +1 -0
- package/types/src/components/utils/question-has-answer.d.ts +17 -0
- package/types/src/components/utils/question-has-answer.d.ts.map +1 -0
- package/types/src/components/utils/question-utils.d.ts +15 -0
- package/types/src/components/utils/question-utils.d.ts.map +1 -0
- package/types/src/controller.d.ts +75 -0
- package/types/src/controller.d.ts.map +1 -0
- package/types/src/index.d.ts +59 -0
- package/types/src/index.d.ts.map +1 -0
- package/types/src/journey/journey-response.d.ts +32 -0
- package/types/src/journey/journey-response.d.ts.map +1 -0
- package/types/src/journey/journey-types.d.ts +28 -0
- package/types/src/journey/journey-types.d.ts.map +1 -0
- package/types/src/journey/journey.d.ts +136 -0
- package/types/src/journey/journey.d.ts.map +1 -0
- package/types/src/lib/address-utils.d.ts +6 -0
- package/types/src/lib/address-utils.d.ts.map +1 -0
- package/types/src/lib/address.d.ts +43 -0
- package/types/src/lib/address.d.ts.map +1 -0
- package/types/src/lib/date-utils.d.ts +60 -0
- package/types/src/lib/date-utils.d.ts.map +1 -0
- package/types/src/lib/session-answer-store.d.ts +88 -0
- package/types/src/lib/session-answer-store.d.ts.map +1 -0
- package/types/src/lib/utils.d.ts +26 -0
- package/types/src/lib/utils.d.ts.map +1 -0
- package/types/src/lib/uuid.d.ts +7 -0
- package/types/src/lib/uuid.d.ts.map +1 -0
- package/types/src/middleware/build-get-journey.d.ts +6 -0
- package/types/src/middleware/build-get-journey.d.ts.map +1 -0
- package/types/src/middleware/redirect-to-unanswered-question.d.ts +12 -0
- package/types/src/middleware/redirect-to-unanswered-question.d.ts.map +1 -0
- package/types/src/questions/create-questions.d.ts +21 -0
- package/types/src/questions/create-questions.d.ts.map +1 -0
- package/types/src/questions/options-question.d.ts +80 -0
- package/types/src/questions/options-question.d.ts.map +1 -0
- package/types/src/questions/question-props.d.ts +182 -0
- package/types/src/questions/question-props.d.ts.map +1 -0
- package/types/src/questions/question-types.d.ts +86 -0
- package/types/src/questions/question-types.d.ts.map +1 -0
- package/types/src/questions/question.d.ts +272 -0
- package/types/src/questions/question.d.ts.map +1 -0
- package/types/src/questions/questions.d.ts +3 -0
- package/types/src/questions/questions.d.ts.map +1 -0
- package/types/src/section.d.ts +107 -0
- package/types/src/section.d.ts.map +1 -0
- package/types/src/validator/address-validator.d.ts +48 -0
- package/types/src/validator/address-validator.d.ts.map +1 -0
- package/types/src/validator/base-validator.d.ts +12 -0
- package/types/src/validator/base-validator.d.ts.map +1 -0
- package/types/src/validator/conditional-required-validator.d.ts +25 -0
- package/types/src/validator/conditional-required-validator.d.ts.map +1 -0
- package/types/src/validator/confirmation-checkbox-validator.d.ts +28 -0
- package/types/src/validator/confirmation-checkbox-validator.d.ts.map +1 -0
- package/types/src/validator/coordinates-validator.d.ts +23 -0
- package/types/src/validator/coordinates-validator.d.ts.map +1 -0
- package/types/src/validator/date-period-validator.d.ts +64 -0
- package/types/src/validator/date-period-validator.d.ts.map +1 -0
- package/types/src/validator/date-time-validator.d.ts +27 -0
- package/types/src/validator/date-time-validator.d.ts.map +1 -0
- package/types/src/validator/date-validator.d.ts +49 -0
- package/types/src/validator/date-validator.d.ts.map +1 -0
- package/types/src/validator/document-upload-validator.d.ts +12 -0
- package/types/src/validator/document-upload-validator.d.ts.map +1 -0
- package/types/src/validator/email-validator.d.ts +74 -0
- package/types/src/validator/email-validator.d.ts.map +1 -0
- package/types/src/validator/multi-field-input-validator.d.ts +91 -0
- package/types/src/validator/multi-field-input-validator.d.ts.map +1 -0
- package/types/src/validator/numeric-validator.d.ts +50 -0
- package/types/src/validator/numeric-validator.d.ts.map +1 -0
- package/types/src/validator/required-validator.d.ts +23 -0
- package/types/src/validator/required-validator.d.ts.map +1 -0
- package/types/src/validator/same-answer-validator.d.ts +19 -0
- package/types/src/validator/same-answer-validator.d.ts.map +1 -0
- package/types/src/validator/string-validator.d.ts +59 -0
- package/types/src/validator/string-validator.d.ts.map +1 -0
- package/types/src/validator/unit-option-entry-validator.d.ts +41 -0
- package/types/src/validator/unit-option-entry-validator.d.ts.map +1 -0
- package/types/src/validator/valid-option-validator.d.ts +19 -0
- package/types/src/validator/valid-option-validator.d.ts.map +1 -0
- package/types/src/validator/validation-error-handler.d.ts +20 -0
- package/types/src/validator/validation-error-handler.d.ts.map +1 -0
- package/types/src/validator/validator.d.ts +5 -0
- package/types/src/validator/validator.d.ts.map +1 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export function validatePostcode(postcode: any, errorMessage?: string): any;
|
|
2
|
+
export const addressLine1MaxLength: 250;
|
|
3
|
+
export const addressLine1MinLength: 0;
|
|
4
|
+
export const addressLine2MaxLength: 250;
|
|
5
|
+
export const addressLine2MinLength: 0;
|
|
6
|
+
export const townCityMaxLength: 250;
|
|
7
|
+
export const townCityMinLength: 0;
|
|
8
|
+
export const countyMaxLength: 250;
|
|
9
|
+
export const countyMinLength: 0;
|
|
10
|
+
export const postcodeMaxLength: 8;
|
|
11
|
+
export const postcodeMinLength: 5;
|
|
12
|
+
/**
|
|
13
|
+
* enforces address fields are within allowed parameters
|
|
14
|
+
* @class
|
|
15
|
+
*/
|
|
16
|
+
export class AddressValidator extends BaseValidator {
|
|
17
|
+
/**
|
|
18
|
+
* creates an instance of an AddressValidator
|
|
19
|
+
* @param {Object} [opts]
|
|
20
|
+
* @param {{addressLine1: boolean, addressLine2: boolean, townCity: boolean, county: boolean, postcode: boolean}} [opts.requiredFields]
|
|
21
|
+
*/
|
|
22
|
+
constructor(opts?: {
|
|
23
|
+
requiredFields?: {
|
|
24
|
+
addressLine1: boolean;
|
|
25
|
+
addressLine2: boolean;
|
|
26
|
+
townCity: boolean;
|
|
27
|
+
county: boolean;
|
|
28
|
+
postcode: boolean;
|
|
29
|
+
} | undefined;
|
|
30
|
+
});
|
|
31
|
+
requiredFields: {
|
|
32
|
+
addressLine1: boolean;
|
|
33
|
+
addressLine2: boolean;
|
|
34
|
+
townCity: boolean;
|
|
35
|
+
county: boolean;
|
|
36
|
+
postcode: boolean;
|
|
37
|
+
} | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* validates response body using questionObj fieldname
|
|
40
|
+
* @param {Question} questionObj
|
|
41
|
+
*/
|
|
42
|
+
validate(questionObj: Question): import("express-validator").ValidationChain[];
|
|
43
|
+
isRequired(): boolean;
|
|
44
|
+
#private;
|
|
45
|
+
}
|
|
46
|
+
export default AddressValidator;
|
|
47
|
+
import BaseValidator from './base-validator.js';
|
|
48
|
+
//# sourceMappingURL=address-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/address-validator.js"],"names":[],"mappings":"AAIO,4EAQN;AAGD,oCAAqC,GAAG,CAAC;AACzC,oCAAqC,CAAC,CAAC;AACvC,oCAAqC,GAAG,CAAC;AACzC,oCAAqC,CAAC,CAAC;AACvC,gCAAiC,GAAG,CAAC;AACrC,gCAAiC,CAAC,CAAC;AACnC,8BAA+B,GAAG,CAAC;AACnC,8BAA+B,CAAC,CAAC;AACjC,gCAAiC,CAAC,CAAC;AACnC,gCAAiC,CAAC,CAAC;AAEnC;;;GAGG;AACH;IACC;;;;OAIG;IACH,mBAFG;QAAqH,cAAc;0BAA5G,OAAO;0BAAgB,OAAO;sBAAY,OAAO;oBAAU,OAAO;sBAAY,OAAO;;KAAwB,EAKtI;IADA;sBAJyB,OAAO;sBAAgB,OAAO;kBAAY,OAAO;gBAAU,OAAO;kBAAY,OAAO;kBAIpE;IAG3C;;;OAGG;IACH,sBAFW,QAAQ,iDAYlB;IA+FD,sBAKC;;CACD;;0BA1JyB,qBAAqB"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../questions/question.js')} Question
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* enforces a field is not empty when condition is satisfied
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
8
|
+
export class ConditionalRequiredValidator extends BaseValidator {
|
|
9
|
+
/**
|
|
10
|
+
* creates an instance of a ConditionalRequiredValidator
|
|
11
|
+
* @param {string} [errorMessage] - custom error message to show on validation failure
|
|
12
|
+
*/
|
|
13
|
+
constructor(errorMessage?: string);
|
|
14
|
+
/**
|
|
15
|
+
* validates the response body, checking the questionObj's fieldname
|
|
16
|
+
* @param {Question} questionObj
|
|
17
|
+
*/
|
|
18
|
+
validate(questionObj: Question): any;
|
|
19
|
+
getConditionalFieldName(questionObj: any, option: any): string;
|
|
20
|
+
isValueIncluded(questionObj: any, value: any): import("express-validator").ValidationChain;
|
|
21
|
+
}
|
|
22
|
+
export default ConditionalRequiredValidator;
|
|
23
|
+
export type Question = typeof import("../questions/question.js");
|
|
24
|
+
import BaseValidator from './base-validator.js';
|
|
25
|
+
//# sourceMappingURL=conditional-required-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-required-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/conditional-required-validator.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;GAGG;AACH;IAMC;;;OAGG;IACH,2BAFW,MAAM,EAQhB;IAED;;;OAGG;IACH,sBAFW,QAAQ,OAclB;IAED,+DAEC;IAED,2FAKC;CACD;;;0BAzDyB,qBAAqB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../questions/question.js')} Question
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* enforces a confirmation checkbox is checked before proceeding
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
8
|
+
export class ConfirmationCheckboxValidator extends BaseValidator {
|
|
9
|
+
/**
|
|
10
|
+
* creates an instance of a ConfirmationCheckboxValidator
|
|
11
|
+
* @param {Object} params
|
|
12
|
+
* @param {string} params.checkboxName
|
|
13
|
+
* @param {string} params.errorMessage - custom error message to show on validation failure
|
|
14
|
+
*/
|
|
15
|
+
constructor({ checkboxName, errorMessage }: {
|
|
16
|
+
checkboxName: string;
|
|
17
|
+
errorMessage: string;
|
|
18
|
+
});
|
|
19
|
+
checkboxName: string;
|
|
20
|
+
/**
|
|
21
|
+
* validates the response body, checking the checkbox name
|
|
22
|
+
*/
|
|
23
|
+
validate(): import("express-validator").ValidationChain;
|
|
24
|
+
}
|
|
25
|
+
export default ConfirmationCheckboxValidator;
|
|
26
|
+
export type Question = typeof import("../questions/question.js");
|
|
27
|
+
import BaseValidator from './base-validator.js';
|
|
28
|
+
//# sourceMappingURL=confirmation-checkbox-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation-checkbox-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/confirmation-checkbox-validator.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH;IAMC;;;;;OAKG;IACH,4CAHG;QAAuB,YAAY,EAA3B,MAAM;QACS,YAAY,EAA3B,MAAM;KAChB,EAMA;IAFA,qBAAgC;IAIjC;;OAEG;IACH,wDAEC;CACD;;;0BAnCyB,qBAAqB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const requiredCoordinateLength: 6;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {Object} CoordinateField
|
|
4
|
+
* @property {string} title
|
|
5
|
+
* @property {string} fieldName
|
|
6
|
+
*/
|
|
7
|
+
export class CoordinatesValidator extends BaseValidator {
|
|
8
|
+
/**
|
|
9
|
+
* @param {CoordinateField} northing
|
|
10
|
+
* @param {CoordinateField} easting
|
|
11
|
+
*/
|
|
12
|
+
constructor(northing: CoordinateField, easting: CoordinateField);
|
|
13
|
+
northing: CoordinateField;
|
|
14
|
+
easting: CoordinateField;
|
|
15
|
+
validate(): import("express-validator").ValidationChain[];
|
|
16
|
+
}
|
|
17
|
+
export default CoordinatesValidator;
|
|
18
|
+
export type CoordinateField = {
|
|
19
|
+
title: string;
|
|
20
|
+
fieldName: string;
|
|
21
|
+
};
|
|
22
|
+
import BaseValidator from './base-validator.js';
|
|
23
|
+
//# sourceMappingURL=coordinates-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinates-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/coordinates-validator.js"],"names":[],"mappings":"AAGA,uCAAwC,CAAC,CAAC;AAE1C;;;;GAIG;AACH;IACC;;;OAGG;IACH,sBAHW,eAAe,WACf,eAAe,EAMzB;IAFA,0BAAwB;IACxB,yBAAsB;IAGvB,0DAkCC;CACD;;;WAjDa,MAAM;eACN,MAAM;;0BARM,qBAAqB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../components/date/question.js')} DateQuestion
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} DateValidationSettings
|
|
6
|
+
* @property {Boolean} ensureFuture
|
|
7
|
+
* @property {Boolean} ensurePast
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* enforces a user has entered a valid date period
|
|
11
|
+
* @class
|
|
12
|
+
*/
|
|
13
|
+
export class DatePeriodValidator extends BaseValidator {
|
|
14
|
+
/**
|
|
15
|
+
* creates an instance of a DateValidator
|
|
16
|
+
* @param {string} inputLabel - string representing the field as displayed on the UI as part of an error message
|
|
17
|
+
* @param {DateValidationSettings} [dateValidationSettings] - object containing rules to apply
|
|
18
|
+
* @param {Object} [errorMessages] - object containing custom error messages to show on validation failure
|
|
19
|
+
*/
|
|
20
|
+
constructor(inputLabel: string, dateValidationSettings?: DateValidationSettings, errorMessages?: Object);
|
|
21
|
+
/** @type {DateValidationSettings} */
|
|
22
|
+
dateValidationSettings: DateValidationSettings;
|
|
23
|
+
emptyErrorMessage: any;
|
|
24
|
+
noDayErrorMessage: any;
|
|
25
|
+
noMonthErrorMessage: any;
|
|
26
|
+
noYearErrorMessage: any;
|
|
27
|
+
noDayMonthErrorMessage: any;
|
|
28
|
+
noDayYearErrorMessage: any;
|
|
29
|
+
noMonthYearErrorMessage: any;
|
|
30
|
+
invalidDateErrorMessage: any;
|
|
31
|
+
invalidMonthErrorMessage: any;
|
|
32
|
+
invalidYearErrorMessage: any;
|
|
33
|
+
futureDateErrorMessage: any;
|
|
34
|
+
pastDateErrorMessage: any;
|
|
35
|
+
/**
|
|
36
|
+
* validates the response body, checking the values sent for the date are valid
|
|
37
|
+
* @param {DateQuestion} questionObj
|
|
38
|
+
*/
|
|
39
|
+
validate(questionObj: DateQuestion): import("express-validator").ValidationChain[];
|
|
40
|
+
rulesForNotEmptyInput({ dayInput, monthInput, yearInput }: {
|
|
41
|
+
dayInput: any;
|
|
42
|
+
monthInput: any;
|
|
43
|
+
yearInput: any;
|
|
44
|
+
}): import("express-validator").ValidationChain[];
|
|
45
|
+
rulesForValidInput({ dayInput, monthInput, yearInput }: {
|
|
46
|
+
dayInput: any;
|
|
47
|
+
monthInput: any;
|
|
48
|
+
yearInput: any;
|
|
49
|
+
}): import("express-validator").ValidationChain[];
|
|
50
|
+
rulesForDateIsInFuture({ dayInput, monthInput, yearInput }: {
|
|
51
|
+
dayInput: any;
|
|
52
|
+
monthInput: any;
|
|
53
|
+
yearInput: any;
|
|
54
|
+
}): import("express-validator").ValidationChain[];
|
|
55
|
+
#private;
|
|
56
|
+
}
|
|
57
|
+
export default DatePeriodValidator;
|
|
58
|
+
export type DateQuestion = typeof import("../components/date/question.js");
|
|
59
|
+
export type DateValidationSettings = {
|
|
60
|
+
ensureFuture: boolean;
|
|
61
|
+
ensurePast: boolean;
|
|
62
|
+
};
|
|
63
|
+
import BaseValidator from './base-validator.js';
|
|
64
|
+
//# sourceMappingURL=date-period-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-period-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/date-period-validator.js"],"names":[],"mappings":"AAQA;;GAEG;AAEH;;;;GAIG;AAEH;;;GAGG;AACH;IAIC;;;;;OAKG;IACH,wBAJW,MAAM,2BACN,sBAAsB,kBACtB,MAAM,EAgChB;IAvCD,qCAAqC;IACrC,wBADW,sBAAsB,CACV;IAoBtB,uBAAmG;IACnG,uBAAmG;IACnG,yBAAyG;IACzG,wBAAsG;IACtG,4BAAkH;IAClH,2BAA+G;IAC/G,6BACuF;IACvF,6BACuF;IACvF,8BACyF;IACzF,6BACuF;IACvF,4BAAkH;IAClH,0BAA4G;IAK7G;;;OAGG;IACH,sBAFW,YAAY,iDAsBtB;IAED;;;;sDAuCC;IAED;;;;sDAwBC;IAED;;;;sDAuBC;;CA6BD;;;;;;;0BA5MyB,qBAAqB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./question.js')} DateTimeQuestion
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* enforces a user has entered a valid date
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
8
|
+
export class DateTimeValidator extends DateValidator {
|
|
9
|
+
/**
|
|
10
|
+
* creates an instance of a DateTimeValidator
|
|
11
|
+
* @param {string} timeInputLabel - string representing the time fields as displayed on the UI as part of an error message
|
|
12
|
+
* @param {string} [dateInputLabel] - string representing the date fields as displayed on the UI as part of an error message
|
|
13
|
+
* @param {DateValidationSettings} [dateValidationSettings] - object containing rules to apply
|
|
14
|
+
* @param {Object} [dateErrorMessages] - object containing custom date error messages to show on validation failure
|
|
15
|
+
*/
|
|
16
|
+
constructor(timeInputLabel: string, dateInputLabel?: string, dateValidationSettings?: DateValidationSettings, dateErrorMessages?: Object);
|
|
17
|
+
timeInputLabel: string;
|
|
18
|
+
/**
|
|
19
|
+
* validates the response body, checking the values sent for the date are valid
|
|
20
|
+
* @param {DateTimeQuestion} questionObj
|
|
21
|
+
*/
|
|
22
|
+
validate(questionObj: DateTimeQuestion): import("express-validator").ValidationChain[];
|
|
23
|
+
}
|
|
24
|
+
export default DateTimeValidator;
|
|
25
|
+
export type DateTimeQuestion = any;
|
|
26
|
+
import DateValidator from './date-validator.js';
|
|
27
|
+
//# sourceMappingURL=date-time-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-time-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/date-time-validator.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;GAGG;AACH;IACC;;;;;;OAMG;IACH,4BALW,MAAM,mBACN,MAAM,2BACN,sBAAsB,sBACtB,MAAM,EAahB;IADA,uBAAoC;IAGrC;;;OAGG;IACH,sBAFW,gBAAgB,iDAsC1B;CACD;;;0BAxEyB,qBAAqB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../components/date/question.js')} DateQuestion
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} DateValidationSettings
|
|
6
|
+
* @property {Boolean} ensureFuture
|
|
7
|
+
* @property {Boolean} ensurePast
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* enforces a user has entered a valid date
|
|
11
|
+
* @class
|
|
12
|
+
*/
|
|
13
|
+
export class DateValidator extends BaseValidator {
|
|
14
|
+
/**
|
|
15
|
+
* creates an instance of a DateValidator
|
|
16
|
+
* @param {string} inputLabel - string representing the field as displayed on the UI as part of an error message
|
|
17
|
+
* @param {DateValidationSettings} [dateValidationSettings] - object containing rules to apply
|
|
18
|
+
* @param {Object} [errorMessages] - object containing custom error messages to show on validation failure
|
|
19
|
+
*/
|
|
20
|
+
constructor(inputLabel: string, dateValidationSettings?: DateValidationSettings, errorMessages?: Object);
|
|
21
|
+
/** @type {DateValidationSettings} */
|
|
22
|
+
dateValidationSettings: DateValidationSettings;
|
|
23
|
+
emptyErrorMessage: any;
|
|
24
|
+
noDayErrorMessage: any;
|
|
25
|
+
noMonthErrorMessage: any;
|
|
26
|
+
noYearErrorMessage: any;
|
|
27
|
+
noDayMonthErrorMessage: any;
|
|
28
|
+
noDayYearErrorMessage: any;
|
|
29
|
+
noMonthYearErrorMessage: any;
|
|
30
|
+
invalidDateErrorMessage: any;
|
|
31
|
+
invalidMonthErrorMessage: any;
|
|
32
|
+
invalidYearErrorMessage: any;
|
|
33
|
+
futureDateErrorMessage: any;
|
|
34
|
+
pastDateErrorMessage: any;
|
|
35
|
+
/**
|
|
36
|
+
* validates the response body, checking the values sent for the date are valid
|
|
37
|
+
* @param {DateQuestion} questionObj
|
|
38
|
+
*/
|
|
39
|
+
validate(questionObj: DateQuestion): import("express-validator").ValidationChain[];
|
|
40
|
+
#private;
|
|
41
|
+
}
|
|
42
|
+
export default DateValidator;
|
|
43
|
+
export type DateQuestion = typeof import("../components/date/question.js");
|
|
44
|
+
export type DateValidationSettings = {
|
|
45
|
+
ensureFuture: boolean;
|
|
46
|
+
ensurePast: boolean;
|
|
47
|
+
};
|
|
48
|
+
import BaseValidator from './base-validator.js';
|
|
49
|
+
//# sourceMappingURL=date-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/date-validator.js"],"names":[],"mappings":"AAQA;;GAEG;AAEH;;;;GAIG;AAEH;;;GAGG;AACH;IAIC;;;;;OAKG;IACH,wBAJW,MAAM,2BACN,sBAAsB,kBACtB,MAAM,EAgChB;IAvCD,qCAAqC;IACrC,wBADW,sBAAsB,CACV;IAoBtB,uBAAmG;IACnG,uBAAmG;IACnG,yBAAyG;IACzG,wBAAsG;IACtG,4BAAkH;IAClH,2BAA+G;IAC/G,6BACuF;IACvF,6BACuF;IACvF,8BACyF;IACzF,6BACuF;IACvF,4BAAkH;IAClH,0BAA4G;IAK7G;;;OAGG;IACH,sBAFW,YAAY,iDAuGtB;;CA6BD;;;;;;;0BAjMyB,qBAAqB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class DocumentUploadValidator extends BaseValidator {
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} fieldName
|
|
4
|
+
* @param {string} errorMessage
|
|
5
|
+
*/
|
|
6
|
+
constructor(fieldName: string, errorMessage?: string);
|
|
7
|
+
fieldName: string;
|
|
8
|
+
validate(): import("express-validator").ValidationChain[];
|
|
9
|
+
}
|
|
10
|
+
export default DocumentUploadValidator;
|
|
11
|
+
import BaseValidator from './base-validator.js';
|
|
12
|
+
//# sourceMappingURL=document-upload-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-upload-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/document-upload-validator.js"],"names":[],"mappings":"AAGA;IACC;;;OAGG;IACH,uBAHW,MAAM,iBACN,MAAM,EAMhB;IAFA,kBAA0B;IAI3B,0DAYC;CACD;;0BA3ByB,qBAAqB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} EmailValidationOptions
|
|
3
|
+
* @property {boolean} [allowDisplayName] - Allow display names (e.g., "John Doe <john@example.com>")
|
|
4
|
+
* @property {boolean} [requireTld] - Require top-level domain
|
|
5
|
+
* @property {boolean} [allowUtf8LocalPart] - Allow UTF8 characters in local part
|
|
6
|
+
* @property {boolean} [allowIpDomain] - Allow IP addresses as domain
|
|
7
|
+
* @property {string} [errorMessage] - Custom error message
|
|
8
|
+
*/
|
|
9
|
+
export class EmailValidator extends BaseValidator {
|
|
10
|
+
/**
|
|
11
|
+
* @param {Object} params
|
|
12
|
+
* @param {EmailValidationOptions} [params.options] - Email validation options
|
|
13
|
+
* @param {string} [params.errorMessage] - Custom error message
|
|
14
|
+
* @param {string} [params.fieldName] - Field name to validate
|
|
15
|
+
*/
|
|
16
|
+
constructor({ options, errorMessage, fieldName }?: {
|
|
17
|
+
options?: EmailValidationOptions | undefined;
|
|
18
|
+
errorMessage?: string | undefined;
|
|
19
|
+
fieldName?: string | undefined;
|
|
20
|
+
});
|
|
21
|
+
options: {
|
|
22
|
+
/**
|
|
23
|
+
* - Allow display names (e.g., "John Doe <john@example.com>")
|
|
24
|
+
*/
|
|
25
|
+
allowDisplayName?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* - Require top-level domain
|
|
28
|
+
*/
|
|
29
|
+
requireTld?: boolean | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* - Allow UTF8 characters in local part
|
|
32
|
+
*/
|
|
33
|
+
allowUtf8LocalPart?: boolean | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* - Allow IP addresses as domain
|
|
36
|
+
*/
|
|
37
|
+
allowIpDomain?: boolean | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* - Custom error message
|
|
40
|
+
*/
|
|
41
|
+
errorMessage?: string | undefined;
|
|
42
|
+
allow_display_name: boolean;
|
|
43
|
+
require_tld: boolean;
|
|
44
|
+
allow_utf8_local_part: boolean;
|
|
45
|
+
allow_ip_domain: boolean;
|
|
46
|
+
};
|
|
47
|
+
fieldName: string | undefined;
|
|
48
|
+
validate(questionObj: any): import("express-validator").ValidationChain;
|
|
49
|
+
}
|
|
50
|
+
export default EmailValidator;
|
|
51
|
+
export type EmailValidationOptions = {
|
|
52
|
+
/**
|
|
53
|
+
* - Allow display names (e.g., "John Doe <john@example.com>")
|
|
54
|
+
*/
|
|
55
|
+
allowDisplayName?: boolean | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* - Require top-level domain
|
|
58
|
+
*/
|
|
59
|
+
requireTld?: boolean | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* - Allow UTF8 characters in local part
|
|
62
|
+
*/
|
|
63
|
+
allowUtf8LocalPart?: boolean | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* - Allow IP addresses as domain
|
|
66
|
+
*/
|
|
67
|
+
allowIpDomain?: boolean | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* - Custom error message
|
|
70
|
+
*/
|
|
71
|
+
errorMessage?: string | undefined;
|
|
72
|
+
};
|
|
73
|
+
import BaseValidator from './base-validator.js';
|
|
74
|
+
//# sourceMappingURL=email-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/email-validator.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH;IACC;;;;;OAKG;IACH,mDAJG;QAAwC,OAAO;QACvB,YAAY;QACZ,SAAS;KACnC,EAcA;IAVA;;;;;;;;;;;;;;;;;;;;;;;;;MAMC;IAGD,8BAA0B;IAG3B,wEAIC;CACD;;;;;;;;;;;;;;;;;;;;;;;;0BAtCyB,qBAAqB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} Regex
|
|
3
|
+
* @property {String | RegExp} regex
|
|
4
|
+
* @property {String} regexMessage
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} MinLength
|
|
8
|
+
* @property {Number} minLength
|
|
9
|
+
* @property {String} minLengthMessage
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Object} MaxLength
|
|
13
|
+
* @property {Number} maxLength
|
|
14
|
+
* @property {String} maxLengthMessage
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {Object} FieldBase
|
|
18
|
+
* @property {string} fieldName
|
|
19
|
+
* @property {MinLength} [minLength]
|
|
20
|
+
* @property {MaxLength} [maxLength]
|
|
21
|
+
* @property {Regex} [regex]
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {FieldBase & {
|
|
25
|
+
* required: true,
|
|
26
|
+
* errorMessage: string
|
|
27
|
+
* }} RequiredField
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {FieldBase & {
|
|
31
|
+
* required?: false,
|
|
32
|
+
* errorMessage?: string
|
|
33
|
+
* }} OptionalField
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {RequiredField | OptionalField} Field
|
|
37
|
+
*/
|
|
38
|
+
export class MultiFieldInputValidator extends BaseValidator {
|
|
39
|
+
/**
|
|
40
|
+
* @param {Object} params
|
|
41
|
+
* @param {Field[]} [params.fields]
|
|
42
|
+
* @param {string} [params.noInputsMessage]
|
|
43
|
+
*/
|
|
44
|
+
constructor({ fields, noInputsMessage }?: {
|
|
45
|
+
fields?: Field[] | undefined;
|
|
46
|
+
noInputsMessage?: string | undefined;
|
|
47
|
+
});
|
|
48
|
+
fields: Field[];
|
|
49
|
+
noInputsMessage: string;
|
|
50
|
+
/**
|
|
51
|
+
* validates response body against question's required fields
|
|
52
|
+
*/
|
|
53
|
+
validate(): import("express-validator").ValidationChain[];
|
|
54
|
+
isRequired(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* checks if a field is required
|
|
57
|
+
* @param {string} fieldName
|
|
58
|
+
* @returns {boolean}
|
|
59
|
+
*/
|
|
60
|
+
inputFieldIsRequired(fieldName: string): boolean;
|
|
61
|
+
}
|
|
62
|
+
export default MultiFieldInputValidator;
|
|
63
|
+
export type Regex = {
|
|
64
|
+
regex: string | RegExp;
|
|
65
|
+
regexMessage: string;
|
|
66
|
+
};
|
|
67
|
+
export type MinLength = {
|
|
68
|
+
minLength: number;
|
|
69
|
+
minLengthMessage: string;
|
|
70
|
+
};
|
|
71
|
+
export type MaxLength = {
|
|
72
|
+
maxLength: number;
|
|
73
|
+
maxLengthMessage: string;
|
|
74
|
+
};
|
|
75
|
+
export type FieldBase = {
|
|
76
|
+
fieldName: string;
|
|
77
|
+
minLength?: MinLength | undefined;
|
|
78
|
+
maxLength?: MaxLength | undefined;
|
|
79
|
+
regex?: Regex | undefined;
|
|
80
|
+
};
|
|
81
|
+
export type RequiredField = FieldBase & {
|
|
82
|
+
required: true;
|
|
83
|
+
errorMessage: string;
|
|
84
|
+
};
|
|
85
|
+
export type OptionalField = FieldBase & {
|
|
86
|
+
required?: false;
|
|
87
|
+
errorMessage?: string;
|
|
88
|
+
};
|
|
89
|
+
export type Field = RequiredField | OptionalField;
|
|
90
|
+
import BaseValidator from './base-validator.js';
|
|
91
|
+
//# sourceMappingURL=multi-field-input-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-field-input-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/multi-field-input-validator.js"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;GAEG;AAEH;IACC;;;;OAIG;IACH,0CAHG;QAAyB,MAAM;QACP,eAAe;KAAC,EAQ1C;IAFA,gBAAoB;IACpB,wBAAwE;IAGzE;;OAEG;IAEH,0DA8BC;IAED,sBAEC;IACD;;;;OAIG;IACH,gCAHW,MAAM,GACJ,OAAO,CAQnB;CACD;;;WA3Ga,SAAS,MAAM;;;;;;;;;;;;eAkBf,MAAM;;;;;4BAOP,SAAS,GAAG;IACpB,QAAQ,EAAE,IAAI,CAAC;IACf,YAAY,EAAE,MAAM,CAAA;CACrB;4BAIS,SAAS,GAAG;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;oBAIS,aAAa,GAAG,aAAa;0BA1ChB,qBAAqB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} MinValue
|
|
3
|
+
* @property {Number} min
|
|
4
|
+
* @property {String} minMessage
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} MaxValue
|
|
8
|
+
* @property {Number} max
|
|
9
|
+
* @property {String} maxMessage
|
|
10
|
+
*/
|
|
11
|
+
export class NumericValidator extends BaseValidator {
|
|
12
|
+
/**
|
|
13
|
+
* @param {Object} params
|
|
14
|
+
* @param {number} [params.min]
|
|
15
|
+
* @param {string} [params.minMessage]
|
|
16
|
+
* @param {number} [params.max]
|
|
17
|
+
* @param {string} [params.maxMessage]
|
|
18
|
+
* @param {RegExp} [params.regex]
|
|
19
|
+
* @param {string} [params.regexMessage]
|
|
20
|
+
* @param {string} [params.fieldName]
|
|
21
|
+
*/
|
|
22
|
+
constructor({ min, minMessage, max, maxMessage, regex, regexMessage, fieldName }?: {
|
|
23
|
+
min?: number | undefined;
|
|
24
|
+
minMessage?: string | undefined;
|
|
25
|
+
max?: number | undefined;
|
|
26
|
+
maxMessage?: string | undefined;
|
|
27
|
+
regex?: RegExp | undefined;
|
|
28
|
+
regexMessage?: string | undefined;
|
|
29
|
+
fieldName?: string | undefined;
|
|
30
|
+
});
|
|
31
|
+
min: number | undefined;
|
|
32
|
+
minMessage: string;
|
|
33
|
+
max: number | undefined;
|
|
34
|
+
maxMessage: string;
|
|
35
|
+
regex: RegExp | undefined;
|
|
36
|
+
regexMessage: string;
|
|
37
|
+
fieldName: string | undefined;
|
|
38
|
+
validate(questionObj: any): import("express-validator").ValidationChain;
|
|
39
|
+
}
|
|
40
|
+
export default NumericValidator;
|
|
41
|
+
export type MinValue = {
|
|
42
|
+
min: number;
|
|
43
|
+
minMessage: string;
|
|
44
|
+
};
|
|
45
|
+
export type MaxValue = {
|
|
46
|
+
max: number;
|
|
47
|
+
maxMessage: string;
|
|
48
|
+
};
|
|
49
|
+
import BaseValidator from './base-validator.js';
|
|
50
|
+
//# sourceMappingURL=numeric-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/numeric-validator.js"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH;;;;GAIG;AAEH;IACC;;;;;;;;;OASG;IACH,mFARG;QAAwB,GAAG;QACH,UAAU;QACV,GAAG;QACH,UAAU;QACV,KAAK;QACL,YAAY;QACZ,SAAS;KAAC,EAWpC;IAPA,wBAAc;IACd,mBAAmE;IACnE,wBAAc;IACd,mBAAkE;IAClE,0BAAkB;IAClB,qBAA0D;IAC1D,8BAA0B;IAG3B,wEAgBC;CACD;;;;;;;;;;0BArDyB,qBAAqB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../questions/question.js')} Question
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* enforces a field is not empty
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
8
|
+
export class RequiredValidator extends BaseValidator {
|
|
9
|
+
/**
|
|
10
|
+
* creates an instance of a RequiredValidator
|
|
11
|
+
* @param {string} [errorMessage] - custom error message to show on validation failure
|
|
12
|
+
*/
|
|
13
|
+
constructor(errorMessage?: string);
|
|
14
|
+
/**
|
|
15
|
+
* validates the response body, checking the questionObj's fieldname
|
|
16
|
+
* @param {Question} questionObj
|
|
17
|
+
*/
|
|
18
|
+
validate(questionObj: Question): import("express-validator").ValidationChain;
|
|
19
|
+
}
|
|
20
|
+
export default RequiredValidator;
|
|
21
|
+
export type Question = typeof import("../questions/question.js");
|
|
22
|
+
import BaseValidator from './base-validator.js';
|
|
23
|
+
//# sourceMappingURL=required-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"required-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/required-validator.js"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH;IAMC;;;OAGG;IACH,2BAFW,MAAM,EAQhB;IAED;;;OAGG;IACH,sBAFW,QAAQ,+CAIlB;CACD;;;0BAnCyB,qBAAqB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal validator to ensure the answer to the current question is not the same as another question's answer
|
|
3
|
+
*/
|
|
4
|
+
export class SameAnswerValidator extends BaseValidator {
|
|
5
|
+
/**
|
|
6
|
+
* @param {string[]} fieldNamesToCompare - field name to compare against
|
|
7
|
+
* @param {string} [errorMessage]
|
|
8
|
+
*/
|
|
9
|
+
constructor(fieldNamesToCompare: string[], errorMessage?: string);
|
|
10
|
+
fieldNamesToCompare: string[];
|
|
11
|
+
/**
|
|
12
|
+
* validates the questionToCompare and compares it to the answer in the journeyResponse
|
|
13
|
+
* @param questionObj
|
|
14
|
+
*/
|
|
15
|
+
validate(questionObj: any): import("express-validator").ValidationChain;
|
|
16
|
+
}
|
|
17
|
+
export default SameAnswerValidator;
|
|
18
|
+
import BaseValidator from './base-validator.js';
|
|
19
|
+
//# sourceMappingURL=same-answer-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"same-answer-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/same-answer-validator.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACC;;;OAGG;IAEH,iCAJW,MAAM,EAAE,iBACR,MAAM,EAOhB;IAFA,8BAAoD;IAIrD;;;OAGG;IACH,wEAQC;CACD;;0BA9ByB,qBAAqB"}
|