@dvsa/cvs-feature-flags 0.10.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 +21 -0
- package/README.md +23 -0
- package/package.json +62 -0
- package/profiles/index.d.ts +3 -0
- package/profiles/index.js +9 -0
- package/profiles/vta.d.ts +11 -0
- package/profiles/vta.js +22 -0
- package/profiles/vtm.d.ts +4 -0
- package/profiles/vtm.js +15 -0
- package/profiles/vtx.d.ts +11 -0
- package/profiles/vtx.js +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Driver & Vehicle Standards Agency
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# cvs-feature-flags
|
|
2
|
+
|
|
3
|
+
Feature flags for the Commercial Vehicle Services (CVS) system, published as a GitHub package.
|
|
4
|
+
|
|
5
|
+
### Pre-requisites
|
|
6
|
+
|
|
7
|
+
- Node.js (Please see `.nvmrc` for specific version)
|
|
8
|
+
- `npm` (If using [n](https://github.com/tj/n) or [nvm](https://github.com/nvm-sh/nvm), this will be automatically managed)
|
|
9
|
+
- Security
|
|
10
|
+
- [Git secrets](https://github.com/awslabs/git-secrets)
|
|
11
|
+
- [ScanRepo](https://github.com/UKHomeOffice/repo-security-scanner)
|
|
12
|
+
- Unzip `repo-security-scanner_<version>_Darwin_<architercture>.tar.gz` and rename the executable inside the folder
|
|
13
|
+
to `scanrepo` - Add executable to path (using `echo $PATH` to find your path)
|
|
14
|
+
|
|
15
|
+
### Getting started
|
|
16
|
+
|
|
17
|
+
###### Run the following command after cloning the project
|
|
18
|
+
|
|
19
|
+
1. `npm install` (or `npm i`)
|
|
20
|
+
|
|
21
|
+
###### The code that will be published lives inside the ./src directory.
|
|
22
|
+
|
|
23
|
+
If wishing to add new top level directories to the output, then they must be included in the `files` array inside `package.json` as well as included in the `clean:temp` command.
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dvsa/cvs-feature-flags",
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "Common package to be used in CVS to manage feature flags",
|
|
5
|
+
"author": "DVSA",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"files": [
|
|
8
|
+
"profiles/**",
|
|
9
|
+
"LICENSE",
|
|
10
|
+
"package.json"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"typescript",
|
|
14
|
+
"nodejs"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "npm run clean && tsc",
|
|
18
|
+
"clean": "rimraf coverage dist && npm run clean:temp",
|
|
19
|
+
"clean:temp": "rimraf profiles",
|
|
20
|
+
"format": "prettier . --write",
|
|
21
|
+
"gitSecrets": "git secrets --scan . && git log -p -- . | scanrepo",
|
|
22
|
+
"lint": "eslint src --ext .ts",
|
|
23
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
24
|
+
"prepare": "husky",
|
|
25
|
+
"test": "jest",
|
|
26
|
+
"test:coverage": "jest --coverage",
|
|
27
|
+
"build:package": "npm run build",
|
|
28
|
+
"prepublishOnly": "npm run build:package && cp -r ./dist/* . && rm -rf ./dist",
|
|
29
|
+
"postpublish": "git clean -fd && npm run clean:temp"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@aws-lambda-powertools/parameters": "^2.1.1",
|
|
33
|
+
"lodash.merge": "^4.6.2"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@aws-sdk/client-appconfigdata": "^3.525.0",
|
|
37
|
+
"@types/aws-lambda": "^8.10.131",
|
|
38
|
+
"@types/jest": "^29.5.11",
|
|
39
|
+
"@types/lodash.merge": "^4.6.9",
|
|
40
|
+
"@types/node": "^20.11.6",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
|
42
|
+
"@typescript-eslint/parser": "^7.9.0",
|
|
43
|
+
"aws-sdk-client-mock": "^3.0.1",
|
|
44
|
+
"aws-sdk-client-mock-jest": "^3.0.1",
|
|
45
|
+
"eslint": "^8.56.0",
|
|
46
|
+
"eslint-plugin-import": "^2.29.1",
|
|
47
|
+
"husky": "^9.0.2",
|
|
48
|
+
"jest": "^29.7.0",
|
|
49
|
+
"lint-staged": "^15.2.0",
|
|
50
|
+
"prettier": "^3.2.4",
|
|
51
|
+
"rimraf": "^5.0.5",
|
|
52
|
+
"ts-jest": "^29.1.2",
|
|
53
|
+
"ts-node": "^10.9.2",
|
|
54
|
+
"typescript": "^5.3.3"
|
|
55
|
+
},
|
|
56
|
+
"lint-staged": {
|
|
57
|
+
"*.ts": [
|
|
58
|
+
"npm run lint:fix",
|
|
59
|
+
"npm run format"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVTMProfile = exports.getVTAProfile = exports.getVTXProfile = void 0;
|
|
4
|
+
var vtx_1 = require("./vtx");
|
|
5
|
+
Object.defineProperty(exports, "getVTXProfile", { enumerable: true, get: function () { return vtx_1.getProfile; } });
|
|
6
|
+
var vta_1 = require("./vta");
|
|
7
|
+
Object.defineProperty(exports, "getVTAProfile", { enumerable: true, get: function () { return vta_1.getProfile; } });
|
|
8
|
+
var vtm_1 = require("./vtm");
|
|
9
|
+
Object.defineProperty(exports, "getVTMProfile", { enumerable: true, get: function () { return vtm_1.getProfile; } });
|
package/profiles/vta.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getProfile = void 0;
|
|
7
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
|
+
const __1 = require("..");
|
|
9
|
+
const feature_flags_1 = require("../feature-flags");
|
|
10
|
+
const defaultFeatureFlags = {
|
|
11
|
+
adr: {
|
|
12
|
+
enabled: false,
|
|
13
|
+
},
|
|
14
|
+
iva: {
|
|
15
|
+
enabled: false,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const getProfile = async () => {
|
|
19
|
+
const flags = await (0, feature_flags_1.getFeatureFlags)(__1.FeatureFlagsClientName.VTA);
|
|
20
|
+
return (0, lodash_merge_1.default)(defaultFeatureFlags, flags);
|
|
21
|
+
};
|
|
22
|
+
exports.getProfile = getProfile;
|
package/profiles/vtm.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getProfile = void 0;
|
|
7
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
|
+
const __1 = require("..");
|
|
9
|
+
const feature_flags_1 = require("../feature-flags");
|
|
10
|
+
const defaultFeatureFlags = {};
|
|
11
|
+
const getProfile = async () => {
|
|
12
|
+
const flags = await (0, feature_flags_1.getFeatureFlags)(__1.FeatureFlagsClientName.VTM);
|
|
13
|
+
return (0, lodash_merge_1.default)(defaultFeatureFlags, flags);
|
|
14
|
+
};
|
|
15
|
+
exports.getProfile = getProfile;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const defaultFeatureFlags: {
|
|
2
|
+
welshTranslation: {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
translatePassTestResult: boolean;
|
|
5
|
+
translateFailTestResult: boolean;
|
|
6
|
+
translatePrsTestResult: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type FeatureFlags = typeof defaultFeatureFlags;
|
|
10
|
+
export declare const getProfile: () => Promise<FeatureFlags>;
|
|
11
|
+
export {};
|
package/profiles/vtx.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getProfile = void 0;
|
|
7
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
|
+
const __1 = require("..");
|
|
9
|
+
const feature_flags_1 = require("../feature-flags");
|
|
10
|
+
const defaultFeatureFlags = {
|
|
11
|
+
welshTranslation: {
|
|
12
|
+
enabled: false,
|
|
13
|
+
translatePassTestResult: false,
|
|
14
|
+
translateFailTestResult: false,
|
|
15
|
+
translatePrsTestResult: false,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const getProfile = async () => {
|
|
19
|
+
const flags = await (0, feature_flags_1.getFeatureFlags)(__1.FeatureFlagsClientName.VTX);
|
|
20
|
+
return (0, lodash_merge_1.default)(defaultFeatureFlags, flags);
|
|
21
|
+
};
|
|
22
|
+
exports.getProfile = getProfile;
|