@dwp/govuk-casa 7.1.2 → 7.1.6
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/CHANGELOG.md +9 -1
- package/lib/ConfigIngestor.js +2 -1
- package/lib/JourneyContext.js +1 -1
- package/lib/JourneyRoad.js +1 -1
- package/lib/RoadConverter.js +8 -3
- package/lib/validation/SimpleField.js +0 -2
- package/lib/validation/processor/queue.js +6 -13
- package/lib/validation/processor.js +6 -1
- package/package.json +21 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to this project will be documented in this file. See [
|
|
3
|
+
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [7.1.6](https://github.com/dwp/govuk-casa/compare/7.1.5...7.1.6) (2022-12-16)
|
|
6
|
+
|
|
7
|
+
### [7.1.5](https://github.com/dwp/govuk-casa/compare/7.1.4...7.1.5) (2022-12-16)
|
|
8
|
+
|
|
9
|
+
### [7.1.4](https://github.com/dwp/govuk-casa/compare/7.1.3...7.1.4) (2022-12-15)
|
|
10
|
+
|
|
11
|
+
### [7.1.3](https://github.com/dwp/govuk-casa/compare/7.1.2...7.1.3) (2022-11-28)
|
|
4
12
|
|
|
5
13
|
### [7.1.2](https://github.com/dwp/govuk-casa/compare/7.1.1...7.1.2) (2022-11-24)
|
|
6
14
|
|
package/lib/ConfigIngestor.js
CHANGED
|
@@ -523,7 +523,8 @@ function ingest(config = {}) {
|
|
|
523
523
|
|
|
524
524
|
// Directory to store compiled assets
|
|
525
525
|
compiledAssetsDir: validateCompiledAssetsDir(
|
|
526
|
-
config.compiledAssetsDir,
|
|
526
|
+
config.compiledAssetsDir,
|
|
527
|
+
config.skipAssetsGeneration,
|
|
527
528
|
),
|
|
528
529
|
|
|
529
530
|
// Content security policies
|
package/lib/JourneyContext.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - Validation errors on that data
|
|
7
7
|
* - Navigation information about how the user got where they are.
|
|
8
8
|
*/
|
|
9
|
-
const clonedeep = require('fast-copy');
|
|
9
|
+
const clonedeep = require('fast-copy').default;
|
|
10
10
|
const { v4: uuidv4, validate: uuidValidate } = require('uuid');
|
|
11
11
|
const { isObjectType, hasProp } = require('./Util.js');
|
|
12
12
|
const { DEFAULT_CONTEXT_ID } = require('./enums.js');
|
package/lib/JourneyRoad.js
CHANGED
|
@@ -20,7 +20,7 @@ class JourneyRoad {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
24
|
* Add a new waypoint(s) to the journey. A waypoint is simply a string (or a
|
|
25
25
|
* function - see below) that uniquely identifies a stopping point on the
|
|
26
26
|
* journey. Typically this will be the URL slug of a single page.
|
package/lib/RoadConverter.js
CHANGED
|
@@ -113,10 +113,15 @@ class RoadConverter {
|
|
|
113
113
|
if (sourceIndex > -1) {
|
|
114
114
|
const choices = Array(numOfChoices).fill(false);
|
|
115
115
|
choices[roadIndex] = true;
|
|
116
|
-
this.setRoute(
|
|
116
|
+
this.setRoute(
|
|
117
|
+
this.pois[sourceIndex].id,
|
|
117
118
|
road.getPOIs()[0].id,
|
|
118
|
-
(r, c) => poi.test(
|
|
119
|
-
|
|
119
|
+
(r, c) => poi.test(
|
|
120
|
+
choices,
|
|
121
|
+
c.data,
|
|
122
|
+
),
|
|
123
|
+
null,
|
|
124
|
+
);
|
|
120
125
|
}
|
|
121
126
|
const roadAlreadyFollowed = this.roadAlreadyFollowed(road);
|
|
122
127
|
if (!roadAlreadyFollowed) {
|
|
@@ -8,10 +8,8 @@ const ValidatorFactory = require('./ValidatorFactory.js');
|
|
|
8
8
|
* @param {Function | null} condition Condition to meet before validators are run
|
|
9
9
|
* @returns {SimpleFieldValidatorConfig} Validation object suitable for processing
|
|
10
10
|
* @throws {TypeError} When conditional is not the correct type
|
|
11
|
-
*
|
|
12
11
|
* @typedef { import('../../index').ValidatorConditionFunction } ValidatorConditionFunction
|
|
13
12
|
* @typedef { import('../../index').ValidatorFunction } ValidatorFunction
|
|
14
|
-
*
|
|
15
13
|
* @typedef {object} SimpleFieldValidatorConfig Prepared field validator
|
|
16
14
|
* @property {string} type The type of field validator (always 'simple')
|
|
17
15
|
* @property {ValidatorConditionFunction} condition Condition to run validators
|
|
@@ -29,19 +29,13 @@ function queueValidator(queue, waypointId, pageMeta, journeyContext, field, vali
|
|
|
29
29
|
switch (validatorObj.type) {
|
|
30
30
|
case T_SIMPLE:
|
|
31
31
|
/* eslint-disable-next-line no-use-before-define */
|
|
32
|
-
return queueSimpleValidator(
|
|
33
|
-
queue, waypointId, pageMeta, journeyContext, field, validatorObj,
|
|
34
|
-
);
|
|
32
|
+
return queueSimpleValidator(queue, waypointId, pageMeta, journeyContext, field, validatorObj);
|
|
35
33
|
case T_OBJECT:
|
|
36
34
|
/* eslint-disable-next-line no-use-before-define */
|
|
37
|
-
return queueObjectValidator(
|
|
38
|
-
queue, waypointId, pageMeta, journeyContext, field, validatorObj,
|
|
39
|
-
);
|
|
35
|
+
return queueObjectValidator(queue, waypointId, pageMeta, journeyContext, field, validatorObj);
|
|
40
36
|
case T_ARRAY_OBJECT:
|
|
41
|
-
/* eslint-disable-next-line no-use-before-define */
|
|
42
|
-
return queueArrayObjectValidator(
|
|
43
|
-
queue, waypointId, pageMeta, journeyContext, field, validatorObj,
|
|
44
|
-
);
|
|
37
|
+
/* eslint-disable-next-line no-use-before-define,max-len */
|
|
38
|
+
return queueArrayObjectValidator(queue, waypointId, pageMeta, journeyContext, field, validatorObj);
|
|
45
39
|
default:
|
|
46
40
|
throw new Error('Unknown or unspecified validator type');
|
|
47
41
|
}
|
|
@@ -173,9 +167,8 @@ function queueObjectValidator(queue, waypointId, pageMeta, journeyContext, field
|
|
|
173
167
|
* @param {object} validatorObj Validation attributes to apply.
|
|
174
168
|
* @returns {void}
|
|
175
169
|
*/
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
) {
|
|
170
|
+
/* eslint-disable-next-line max-len */
|
|
171
|
+
function queueArrayObjectValidator(queue, waypointId, pageMeta, journeyContext, field, validatorObj) {
|
|
179
172
|
// Add this validator's rules to the queue (if any)
|
|
180
173
|
queueSimpleValidator(queue, waypointId, pageMeta, journeyContext, field, validatorObj);
|
|
181
174
|
|
|
@@ -26,7 +26,12 @@ module.exports = ({
|
|
|
26
26
|
const validatorQueue = [];
|
|
27
27
|
Object.keys(pageMeta.fieldValidators).forEach((field) => {
|
|
28
28
|
queueValidator(
|
|
29
|
-
validatorQueue,
|
|
29
|
+
validatorQueue,
|
|
30
|
+
waypointId,
|
|
31
|
+
pageMeta,
|
|
32
|
+
journeyContext,
|
|
33
|
+
field,
|
|
34
|
+
pageMeta.fieldValidators[field],
|
|
30
35
|
);
|
|
31
36
|
});
|
|
32
37
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dwp/govuk-casa",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.6",
|
|
4
4
|
"description": "Framework for creating basic GOVUK Collect-And-Submit-Applications",
|
|
5
5
|
"main": "casa.js",
|
|
6
6
|
"files": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": "^14.6.0 || ^16.0.0 || ^18.0.0",
|
|
26
|
-
"npm": "^
|
|
26
|
+
"npm": "^6.0.0"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
@@ -35,52 +35,51 @@
|
|
|
35
35
|
"csurf": "1.11.0",
|
|
36
36
|
"debug": "4.3.4",
|
|
37
37
|
"dot-object": "2.1.4",
|
|
38
|
-
"fast-copy": "
|
|
39
|
-
"fs-extra": "
|
|
38
|
+
"fast-copy": "3.0.0",
|
|
39
|
+
"fs-extra": "11.1.0",
|
|
40
40
|
"govuk-frontend": "3.14.0",
|
|
41
41
|
"govuk_template_jinja": "0.26.0",
|
|
42
42
|
"graphlib": "2.1.8",
|
|
43
43
|
"klaw-sync": "6.0.0",
|
|
44
44
|
"lodash.merge": "4.6.2",
|
|
45
|
-
"luxon": "
|
|
45
|
+
"luxon": "3.1.1",
|
|
46
46
|
"nunjucks": "3.2.3",
|
|
47
47
|
"serve-favicon": "2.5.0",
|
|
48
48
|
"uid-safe": "2.1.5",
|
|
49
|
-
"uuid": "
|
|
49
|
+
"uuid": "9.0.0",
|
|
50
50
|
"validator": "13.7.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@commitlint/cli": "
|
|
54
|
-
"@commitlint/config-conventional": "
|
|
55
|
-
"@commitlint/travis-cli": "
|
|
56
|
-
"@dwp/commitlint-config-base": "
|
|
57
|
-
"@dwp/eslint-config-base": "
|
|
58
|
-
"@stryker-mutator/core": "
|
|
53
|
+
"@commitlint/cli": "17.3.0",
|
|
54
|
+
"@commitlint/config-conventional": "17.3.0",
|
|
55
|
+
"@commitlint/travis-cli": "17.3.0",
|
|
56
|
+
"@dwp/commitlint-config-base": "4.0.0",
|
|
57
|
+
"@dwp/eslint-config-base": "6.0.0",
|
|
58
|
+
"@stryker-mutator/core": "6.3.0",
|
|
59
59
|
"@stryker-mutator/html-reporter": "3.1.0",
|
|
60
60
|
"@stryker-mutator/javascript-mutator": "4.0.0",
|
|
61
61
|
"@stryker-mutator/mocha-framework": "4.0.0",
|
|
62
|
-
"@stryker-mutator/mocha-runner": "
|
|
62
|
+
"@stryker-mutator/mocha-runner": "6.3.0",
|
|
63
63
|
"autocannon": "7.10.0",
|
|
64
64
|
"chai": "4.3.7",
|
|
65
65
|
"chai-as-promised": "7.1.1",
|
|
66
66
|
"chai-http": "4.3.0",
|
|
67
67
|
"cheerio": "1.0.0-rc.12",
|
|
68
68
|
"conventional-changelog-cli": "2.2.2",
|
|
69
|
-
"eslint": "
|
|
69
|
+
"eslint": "8.29.0",
|
|
70
70
|
"eslint-plugin-no-unsafe-regex": "1.0.0",
|
|
71
|
-
"eslint-plugin-sonarjs": "0.
|
|
71
|
+
"eslint-plugin-sonarjs": "0.17.0",
|
|
72
72
|
"express": "4.18.2",
|
|
73
73
|
"express-session": "1.17.3",
|
|
74
|
-
"husky": "
|
|
75
|
-
"jsdom": "
|
|
76
|
-
"
|
|
77
|
-
"mocha": "9.2.2",
|
|
74
|
+
"husky": "8.0.2",
|
|
75
|
+
"jsdom": "20.0.3",
|
|
76
|
+
"mocha": "10.2.0",
|
|
78
77
|
"nyc": "15.1.0",
|
|
79
78
|
"proxyquire": "2.1.3",
|
|
80
|
-
"sass": "1.56.
|
|
81
|
-
"sinon": "
|
|
79
|
+
"sass": "1.56.2",
|
|
80
|
+
"sinon": "15.0.0",
|
|
82
81
|
"sinon-chai": "3.7.0",
|
|
83
|
-
"supertest": "6.3.
|
|
82
|
+
"supertest": "6.3.3",
|
|
84
83
|
"uglify-js": "3.17.4",
|
|
85
84
|
"yargs": "17.6.2"
|
|
86
85
|
},
|