hof 20.0.0-redis-beta.32-redis-beta → 20.0.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.
Files changed (32) hide show
  1. package/.github/workflows/automate-publish.yml +1 -1
  2. package/.github/workflows/automate-tag.yml +4 -4
  3. package/.nyc_output/7c548a7f-5c40-44b2-b9fb-648341a23d6f.json +1 -0
  4. package/.nyc_output/processinfo/7c548a7f-5c40-44b2-b9fb-648341a23d6f.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/.vscode/settings.json +6 -0
  7. package/README.md +6 -0
  8. package/components/notify/notify.js +1 -1
  9. package/config/hof-defaults.js +1 -2
  10. package/config/sanitisation-rules.js +20 -17
  11. package/controller/base-controller.js +5 -3
  12. package/controller/controller.js +5 -0
  13. package/frontend/govuk-template/govuk_template_generated.html +104 -0
  14. package/frontend/template-partials/views/layout.html +2 -2
  15. package/frontend/template-partials/views/partials/maincontent-left.html +2 -2
  16. package/frontend/template-partials/views/partials/navigation.html +2 -2
  17. package/frontend/template-partials/views/partials/summary-table-row.html +2 -2
  18. package/frontend/template-partials/views/session-timeout.html +2 -1
  19. package/index.js +1 -1
  20. package/lib/health.js +1 -1
  21. package/lib/sessions.js +1 -1
  22. package/middleware/errors.js +2 -0
  23. package/middleware/rate-limiter.js +1 -3
  24. package/package.json +5 -4
  25. package/sandbox/.env +1 -0
  26. package/sandbox/apps/sandbox/translations/en/default.json +15 -36
  27. package/sandbox/public/css/app.css +6605 -12
  28. package/sandbox/public/js/bundle.js +2792 -22
  29. package/sandbox/server.js +1 -1
  30. package/wizard/middleware/check-progress.js +36 -1
  31. package/.nyc_output/cb764db8-e9f0-43bb-b3b1-7af57bb79bb5.json +0 -1
  32. package/.nyc_output/processinfo/cb764db8-e9f0-43bb-b3b1-7af57bb79bb5.json +0 -1
package/sandbox/server.js CHANGED
@@ -14,5 +14,5 @@ bootstrap({
14
14
  }
15
15
  },
16
16
  getAccessibility: true,
17
- "port": 8080
17
+ "port": 8082
18
18
  });
@@ -28,6 +28,41 @@ module.exports = (route, controller, steps, begin) => {
28
28
  return _.uniq(allSteps);
29
29
  };
30
30
 
31
+ // Gets all the possible routes
32
+ const walkAllPossibleSteps = (stepName, allStepsInService, allVisitedSteps) => {
33
+ const stepIncludingFieldsAndForks = allStepsInService[stepName];
34
+ if (!stepIncludingFieldsAndForks) { return; }
35
+
36
+ const forkTargets = _.map(stepIncludingFieldsAndForks.forks, 'target') || [];
37
+ const nextStep = stepIncludingFieldsAndForks.next || '';
38
+
39
+ // If there is no next step or fork, then we have reached the end of the journey
40
+ if (!forkTargets.length && !nextStep) {
41
+ allVisitedSteps.push(stepName);
42
+ // eslint-disable-next-line consistent-return
43
+ return _.uniq(allVisitedSteps);
44
+ }
45
+
46
+ const nextStepsAndForks = _.uniq(forkTargets.concat(nextStep));
47
+
48
+ // We need to transverse through all 'Next' and 'Forks' for this route
49
+ nextStepsAndForks.map(each => {
50
+ if (!allVisitedSteps.includes(each)) {
51
+ allVisitedSteps.push(each);
52
+ walkAllPossibleSteps(each, allStepsInService, allVisitedSteps);
53
+ }
54
+ });
55
+ };
56
+
57
+ // Create a list of all visited steps
58
+ const createAllVisitedSteps = (stepName, allStepsInService) => {
59
+ const allVisitedSteps = [stepName];
60
+ if (allStepsInService[stepName]) {
61
+ walkAllPossibleSteps(stepName, allStepsInService, allVisitedSteps);
62
+ }
63
+ return _.uniq(allVisitedSteps);
64
+ };
65
+
31
66
  const invalidateStep = (stepName, scopedSteps, sessionModel) => {
32
67
  debug('Invalidating', stepName);
33
68
  const step = scopedSteps[stepName] || {};
@@ -55,7 +90,7 @@ module.exports = (route, controller, steps, begin) => {
55
90
  debug('next', nextStep);
56
91
  debug('potential paths', potentialPaths);
57
92
  // if we're following a loop then allow the loop to be invalidated
58
- const whitelist = isLoop(nextStep, req.path) ? [route] : getAllPossibleSteps(nextStep, steps);
93
+ const whitelist = isLoop(nextStep, req.path) ? [route] : createAllVisitedSteps(nextStep, steps);
59
94
  // aggregate all potential journeys from the invalidating step
60
95
  const invalidateSteps = potentialPaths.reduce((arr, step) => arr.concat(getAllPossibleSteps(step, steps)), []);
61
96