@dwp/govuk-casa 8.7.4 → 8.7.5
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/casa.d.ts +21 -0
- package/dist/casa.js +7 -0
- package/dist/lib/JourneyContext.d.ts +13 -17
- package/dist/lib/JourneyContext.js +7 -7
- package/package.json +6 -6
package/dist/casa.d.ts
CHANGED
|
@@ -446,6 +446,27 @@ export type PlanArbiterParams = {
|
|
|
446
446
|
traverseOptions: PlanTraverseOptions;
|
|
447
447
|
};
|
|
448
448
|
export type PlanArbiter = (route: PlanArbiterParams) => PlanRoute[];
|
|
449
|
+
/**
|
|
450
|
+
* Journey Context Object
|
|
451
|
+
*/
|
|
452
|
+
export type JourneyContextObject = {
|
|
453
|
+
/**
|
|
454
|
+
* Data
|
|
455
|
+
*/
|
|
456
|
+
data?: Record<string, any> | undefined;
|
|
457
|
+
/**
|
|
458
|
+
* Validation state
|
|
459
|
+
*/
|
|
460
|
+
validation?: any;
|
|
461
|
+
/**
|
|
462
|
+
* Navigation meta
|
|
463
|
+
*/
|
|
464
|
+
nav?: any;
|
|
465
|
+
/**
|
|
466
|
+
* Identity meta
|
|
467
|
+
*/
|
|
468
|
+
identity?: any;
|
|
469
|
+
};
|
|
449
470
|
import configure from "./lib/configure.js";
|
|
450
471
|
import validators from "./lib/validators/index.js";
|
|
451
472
|
import field from "./lib/field.js";
|
package/dist/casa.js
CHANGED
|
@@ -299,3 +299,10 @@ exports.nunjucksFilters = nunjucksFilters;
|
|
|
299
299
|
* @param {PlanArbiterParams} route Route metadata
|
|
300
300
|
* @returns {PlanRoute[]} Returns all routes, excluding those that the arbiter could eliminate
|
|
301
301
|
*/
|
|
302
|
+
/**
|
|
303
|
+
* @typedef {object} JourneyContextObject Journey Context Object
|
|
304
|
+
* @property {Record<string,any>} [data] Data
|
|
305
|
+
* @property {any} [validation] Validation state
|
|
306
|
+
* @property {any} [nav] Navigation meta
|
|
307
|
+
* @property {any} [identity] Identity meta
|
|
308
|
+
*/
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
* @access private
|
|
11
11
|
* @typedef {import('../casa').ContextEvent} ContextEvent
|
|
12
12
|
*/
|
|
13
|
+
/**
|
|
14
|
+
* @access private
|
|
15
|
+
* @typedef {import('../casa').JourneyContextObject} JourneyContextObject
|
|
16
|
+
*/
|
|
13
17
|
/**
|
|
14
18
|
* @access private
|
|
15
19
|
* @typedef {import('express').Request} ExpressRequest
|
|
@@ -23,19 +27,10 @@ export default class JourneyContext {
|
|
|
23
27
|
/**
|
|
24
28
|
* Create a new JourneyContext using the plain object.
|
|
25
29
|
*
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {object} obj.data Data
|
|
28
|
-
* @param {object} obj.validation Validation state
|
|
29
|
-
* @param {object} obj.nav Navigation meta
|
|
30
|
-
* @param {object} obj.identity Identity meta
|
|
30
|
+
* @param {JourneyContextObject} obj Object.
|
|
31
31
|
* @returns {JourneyContext} Instance.
|
|
32
32
|
*/
|
|
33
|
-
static fromObject({ data, validation, nav, identity, }?:
|
|
34
|
-
data: object;
|
|
35
|
-
validation: object;
|
|
36
|
-
nav: object;
|
|
37
|
-
identity: object;
|
|
38
|
-
}): JourneyContext;
|
|
33
|
+
static fromObject({ data, validation, nav, identity, }?: JourneyContextObject): JourneyContext;
|
|
39
34
|
/**
|
|
40
35
|
* Construct a new ephemeral JourneyContext instance with a unique ID.
|
|
41
36
|
*
|
|
@@ -184,20 +179,20 @@ export default class JourneyContext {
|
|
|
184
179
|
* `identity` holds information that helps uniquely identify this context
|
|
185
180
|
* among a group of contexts stored in the session.
|
|
186
181
|
*
|
|
187
|
-
* @param {Record<string,
|
|
182
|
+
* @param {Record<string,any>} data Entire journey data.
|
|
188
183
|
* @param {object} validation Page errors (indexed by waypoint id).
|
|
189
184
|
* @param {object} nav Navigation context.
|
|
190
185
|
* @param {object} identity Some metadata for identifying this context among others.
|
|
191
186
|
*/
|
|
192
|
-
constructor(data?: Record<string,
|
|
187
|
+
constructor(data?: Record<string, any>, validation?: object, nav?: object, identity?: object);
|
|
193
188
|
/**
|
|
194
189
|
* Clone into an object that can be stringified.
|
|
195
190
|
*
|
|
196
|
-
* @returns {
|
|
191
|
+
* @returns {JourneyContextObject} Plain object.
|
|
197
192
|
*/
|
|
198
|
-
toObject():
|
|
199
|
-
set data(arg: Record<string,
|
|
200
|
-
get data(): Record<string,
|
|
193
|
+
toObject(): JourneyContextObject;
|
|
194
|
+
set data(arg: Record<string, any>);
|
|
195
|
+
get data(): Record<string, any>;
|
|
201
196
|
get validation(): object;
|
|
202
197
|
get nav(): object;
|
|
203
198
|
get identity(): object;
|
|
@@ -354,5 +349,6 @@ export default class JourneyContext {
|
|
|
354
349
|
export type Page = import('../casa').Page;
|
|
355
350
|
export type ContextEventHandler = import('../casa').ContextEventHandler;
|
|
356
351
|
export type ContextEvent = import('../casa').ContextEvent;
|
|
352
|
+
export type JourneyContextObject = import('../casa').JourneyContextObject;
|
|
357
353
|
export type ExpressRequest = import('express').Request;
|
|
358
354
|
import ValidationError from "./ValidationError.js";
|
|
@@ -54,6 +54,10 @@ const log = (0, logger_js_1.default)('lib:journey-context');
|
|
|
54
54
|
* @access private
|
|
55
55
|
* @typedef {import('../casa').ContextEvent} ContextEvent
|
|
56
56
|
*/
|
|
57
|
+
/**
|
|
58
|
+
* @access private
|
|
59
|
+
* @typedef {import('../casa').JourneyContextObject} JourneyContextObject
|
|
60
|
+
*/
|
|
57
61
|
/**
|
|
58
62
|
* @access private
|
|
59
63
|
* @typedef {import('express').Request} ExpressRequest
|
|
@@ -88,7 +92,7 @@ class JourneyContext {
|
|
|
88
92
|
* `identity` holds information that helps uniquely identify this context
|
|
89
93
|
* among a group of contexts stored in the session.
|
|
90
94
|
*
|
|
91
|
-
* @param {Record<string,
|
|
95
|
+
* @param {Record<string,any>} data Entire journey data.
|
|
92
96
|
* @param {object} validation Page errors (indexed by waypoint id).
|
|
93
97
|
* @param {object} nav Navigation context.
|
|
94
98
|
* @param {object} identity Some metadata for identifying this context among others.
|
|
@@ -111,7 +115,7 @@ class JourneyContext {
|
|
|
111
115
|
/**
|
|
112
116
|
* Clone into an object that can be stringified.
|
|
113
117
|
*
|
|
114
|
-
* @returns {
|
|
118
|
+
* @returns {JourneyContextObject} Plain object.
|
|
115
119
|
*/
|
|
116
120
|
toObject() {
|
|
117
121
|
return Object.assign(Object.create(null), {
|
|
@@ -124,11 +128,7 @@ class JourneyContext {
|
|
|
124
128
|
/**
|
|
125
129
|
* Create a new JourneyContext using the plain object.
|
|
126
130
|
*
|
|
127
|
-
* @param {
|
|
128
|
-
* @param {object} obj.data Data
|
|
129
|
-
* @param {object} obj.validation Validation state
|
|
130
|
-
* @param {object} obj.nav Navigation meta
|
|
131
|
-
* @param {object} obj.identity Identity meta
|
|
131
|
+
* @param {JourneyContextObject} obj Object.
|
|
132
132
|
* @returns {JourneyContext} Instance.
|
|
133
133
|
*/
|
|
134
134
|
static fromObject({ data = Object.create(null), validation = Object.create(null), nav = Object.create(null), identity = Object.create(null), } = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dwp/govuk-casa",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.5",
|
|
4
4
|
"description": "A framework for building GOVUK Collect-And-Submit-Applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
"@dwp/casa-spiderplan-a11y-plugin": "0.1.8",
|
|
77
77
|
"@dwp/casa-spiderplan-zap-plugin": "0.1.4",
|
|
78
78
|
"@dwp/eslint-config-base": "6.0.0",
|
|
79
|
-
"@types/express": "4.17.
|
|
80
|
-
"@types/node": "18.11.
|
|
79
|
+
"@types/express": "4.17.15",
|
|
80
|
+
"@types/node": "18.11.16",
|
|
81
81
|
"@types/nunjucks": "3.2.1",
|
|
82
82
|
"c8": "7.12.0",
|
|
83
83
|
"chai": "4.3.7",
|
|
84
84
|
"cheerio": "1.0.0-rc.12",
|
|
85
85
|
"commitlint": "17.3.0",
|
|
86
86
|
"docdash": "2.0.0",
|
|
87
|
-
"eslint": "8.
|
|
87
|
+
"eslint": "8.30.0",
|
|
88
88
|
"eslint-plugin-no-unsafe-regex": "1.0.0",
|
|
89
89
|
"eslint-plugin-security": "1.5.0",
|
|
90
90
|
"eslint-plugin-sonarjs": "0.17.0",
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"jsdoc": "4.0.0",
|
|
93
93
|
"jsdoc-tsimport-plugin": "1.0.5",
|
|
94
94
|
"mocha": "10.2.0",
|
|
95
|
-
"sass": "1.
|
|
96
|
-
"sinon": "
|
|
95
|
+
"sass": "1.57.0",
|
|
96
|
+
"sinon": "15.0.1",
|
|
97
97
|
"sinon-chai": "3.7.0",
|
|
98
98
|
"supertest": "6.3.3",
|
|
99
99
|
"typescript": "4.9.4"
|