@defra/fcp-sfd-frontend-engine 0.1.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/LICENSE +8 -0
- package/README.md +48 -0
- package/package.json +49 -0
- package/src/index.js +1 -0
- package/src/mappers/personal-business-details-mapper.js +25 -0
- package/tsup.config.js +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
The Open Government Licence (OGL) Version 3
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Defra
|
|
4
|
+
|
|
5
|
+
This source code is licensed under the Open Government Licence v3.0. To view this
|
|
6
|
+
licence, visit www.nationalarchives.gov.uk/doc/open-government-licence/version/3
|
|
7
|
+
or write to the Information Policy Team, The National Archives, Kew, Richmond,
|
|
8
|
+
Surrey, TW9 4DU.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Frontend Engine
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This project aims to create a shared frontend engine used by both the internal and external frontend applications.
|
|
6
|
+
|
|
7
|
+
The goal is to reduce duplicated code, improve consistency between applications, and simplify long-term maintenance while still allowing each application to evolve independently where needed.
|
|
8
|
+
|
|
9
|
+
## Architecture Direction
|
|
10
|
+
|
|
11
|
+
The frontend engine will contain shared frontend functionality such as:
|
|
12
|
+
|
|
13
|
+
- shared components
|
|
14
|
+
- utilities
|
|
15
|
+
- validation
|
|
16
|
+
- queries and mutations
|
|
17
|
+
- presenters
|
|
18
|
+
|
|
19
|
+
The internal and external applications will continue to own:
|
|
20
|
+
|
|
21
|
+
- routes
|
|
22
|
+
- authentication
|
|
23
|
+
- app-specific pages and features
|
|
24
|
+
|
|
25
|
+
## Development Approach
|
|
26
|
+
|
|
27
|
+
We are starting with a small incremental implementation rather than a full migration.
|
|
28
|
+
|
|
29
|
+
The initial focus is to:
|
|
30
|
+
|
|
31
|
+
- identify common frontend patterns
|
|
32
|
+
- extract reusable functionality into the engine
|
|
33
|
+
- prove the shared architecture works cleanly
|
|
34
|
+
- minimise disruption to the existing applications
|
|
35
|
+
|
|
36
|
+
## Local Development
|
|
37
|
+
|
|
38
|
+
During development, the applications will consume the engine as a local package dependency.
|
|
39
|
+
|
|
40
|
+
Docker-based local development support will be used so engine changes can be picked up quickly during development.
|
|
41
|
+
|
|
42
|
+
## Principles
|
|
43
|
+
|
|
44
|
+
- keep the implementation simple and explicit
|
|
45
|
+
- prefer shared reusable modules over duplication
|
|
46
|
+
- avoid premature abstraction
|
|
47
|
+
- maintain clear ownership boundaries between the engine and applications
|
|
48
|
+
- evolve incrementally
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@defra/fcp-sfd-frontend-engine",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared frontend engine used by both the internal and external frontend applications.",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/index.js",
|
|
9
|
+
"require": "./dist/index.cjs"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "eslint",
|
|
14
|
+
"lint:fix": "eslint --fix",
|
|
15
|
+
"build": "tsup",
|
|
16
|
+
"test": "npm run build && vitest run --coverage",
|
|
17
|
+
"test:watch": "vitest"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/DEFRA/fcp-sfd-frontend-engine.git"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"fcp-sfd-frontend",
|
|
25
|
+
"defra",
|
|
26
|
+
"fcp"
|
|
27
|
+
],
|
|
28
|
+
"author": "Defra DDTS",
|
|
29
|
+
"contributors": [
|
|
30
|
+
"Rebecca Ransome <rebecca.ransome@defra.gov.uk>",
|
|
31
|
+
"Adam Kay <adam.kay@defra.gov.uk>"
|
|
32
|
+
],
|
|
33
|
+
"license": "OGL-UK-3.0",
|
|
34
|
+
"type": "module",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/DEFRA/fcp-sfd-frontend-engine/issues"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/DEFRA/fcp-sfd-frontend-engine#readme",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@vitest/coverage-v8": "4.0.16",
|
|
41
|
+
"eslint": "9.39.2",
|
|
42
|
+
"neostandard": "0.12.2",
|
|
43
|
+
"tsup": "8.5.0",
|
|
44
|
+
"vitest": "4.0.16"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"joi": "17.13.3"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mapPersonalBusinessDetails } from './mappers/personal-business-details-mapper.js'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Takes the raw data and maps it to a more usable format
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} value - The data from the DAL
|
|
5
|
+
*
|
|
6
|
+
* @returns {Object} Formatted personal business details data
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const mapPersonalBusinessDetails = (value) => {
|
|
10
|
+
return {
|
|
11
|
+
info: {
|
|
12
|
+
userName: [
|
|
13
|
+
value.customer.info.name.first,
|
|
14
|
+
value.customer.info.name.last
|
|
15
|
+
].filter(Boolean).join(' ')
|
|
16
|
+
},
|
|
17
|
+
business: {
|
|
18
|
+
info: {
|
|
19
|
+
organisationId: value.business.organisationId ?? null,
|
|
20
|
+
sbi: value.business.sbi ?? null,
|
|
21
|
+
name: value.business.info.name ?? null
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|