From b717917500804c93cb6c2234d7c70f8f049682c0 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 25 Jul 2023 12:25:33 +0100 Subject: [PATCH] Continute typescript conversion Signed-off-by: Fred Boniface --- ...{domains.configs.js => domains.configs.ts} | 5 ++-- ...Codes.configs.js => errorCodes.configs.ts} | 5 +++- src/configs/version.configs.js | 6 ---- src/configs/version.configs.ts | 12 ++++++++ src/utils/varTest.utils.js | 28 ------------------- 5 files changed, 19 insertions(+), 37 deletions(-) rename src/configs/{domains.configs.js => domains.configs.ts} (91%) rename src/configs/{errorCodes.configs.js => errorCodes.configs.ts} (80%) delete mode 100644 src/configs/version.configs.js create mode 100644 src/configs/version.configs.ts delete mode 100644 src/utils/varTest.utils.js diff --git a/src/configs/domains.configs.js b/src/configs/domains.configs.ts similarity index 91% rename from src/configs/domains.configs.js rename to src/configs/domains.configs.ts index a5013fa..ec8ed88 100644 --- a/src/configs/domains.configs.js +++ b/src/configs/domains.configs.ts @@ -1,4 +1,4 @@ -const valid = [ +const valid: string[] = [ 'owlboard.info', 'avantiwestcoast.co.uk', 'btp.police.uk', @@ -33,4 +33,5 @@ const valid = [ 'wmtrains.co.uk', ]; -module.exports = valid; \ No newline at end of file +module.exports = valid; +export { valid } \ No newline at end of file diff --git a/src/configs/errorCodes.configs.js b/src/configs/errorCodes.configs.ts similarity index 80% rename from src/configs/errorCodes.configs.js rename to src/configs/errorCodes.configs.ts index 49fe495..0e9e250 100644 --- a/src/configs/errorCodes.configs.js +++ b/src/configs/errorCodes.configs.ts @@ -1,3 +1,5 @@ +// statusCodes should be a map, not an object + const statusCodes = { 400: 'data not found', 700: 'no authentication attempt', @@ -12,4 +14,5 @@ const statusCodes = { 951: 'unknown server error' }; -module.exports = statusCodes; \ No newline at end of file +module.exports = statusCodes; +export { statusCodes } \ No newline at end of file diff --git a/src/configs/version.configs.js b/src/configs/version.configs.js deleted file mode 100644 index 7ea3384..0000000 --- a/src/configs/version.configs.js +++ /dev/null @@ -1,6 +0,0 @@ -const version = { - api: ['/api/v1/','/api/v2'], - app: '2023.7.8' -}; - -module.exports = version; \ No newline at end of file diff --git a/src/configs/version.configs.ts b/src/configs/version.configs.ts new file mode 100644 index 0000000..93e0131 --- /dev/null +++ b/src/configs/version.configs.ts @@ -0,0 +1,12 @@ +interface versions { + api: string[], + app: string +} + +const version: versions = { + api: ['/api/v1/','/api/v2'], + app: '2023.7.8' +}; + +module.exports = version; +export { version } \ No newline at end of file diff --git a/src/utils/varTest.utils.js b/src/utils/varTest.utils.js deleted file mode 100644 index f4db80e..0000000 --- a/src/utils/varTest.utils.js +++ /dev/null @@ -1,28 +0,0 @@ -/* global process */ -// Checks that all required environment variables are present. -// Returns True or False and offers an object detailing what is missing. - -async function varTest(){ - var required = { - OWL_LDB_KEY: process.env.OWL_LDB_KEY, - OWL_LDB_CORPUSUSER: process.env.OWL_LDB_CORPUSUSER, - OWL_LDB_CORPUSPASS: process.env.OWL_LDB_CORPUSPASS, - OWL_NOT_USED: process.env.OWL_NOT_USED - }; - var desired = { - OWL_DB_PASS: process.env.OWL_DB_PASS - }; - // DO NOT LOG CREDENTIALS!!! - - // Test that each of required is NOT undefined. - // var pass = true if all okay, false if not. - // Append any missing values to missing_required = [] - // Test that each of desired is NOT undefined. - // Append any missing values to missing_desired = [] - - // Return : {pass: $pass, missong_required = $missing_required, missing_desired = $missing_desired} -} - -module.exports = { - varTest -}; \ No newline at end of file