Continute typescript conversion

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-07-25 12:25:33 +01:00
parent 93c8aed105
commit b717917500
5 changed files with 19 additions and 37 deletions

View File

@ -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;
module.exports = valid;
export { valid }

View File

@ -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;
module.exports = statusCodes;
export { statusCodes }

View File

@ -1,6 +0,0 @@
const version = {
api: ['/api/v1/','/api/v2'],
app: '2023.7.8'
};
module.exports = version;

View File

@ -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 }

View File

@ -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
};