Update Types

This commit is contained in:
Tben 2023-08-13 14:56:56 +01:00
parent 80e34fa6ec
commit 4aa65011e3
31 changed files with 60 additions and 39 deletions

View File

@ -94,7 +94,7 @@ module.exports = async function imageInputFileToBase64({ imageInputFile, maxWidt
imageName: imageName,
imageSize: imageSize,
};
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Image Processing Error! =>", error.message);
return {

View File

@ -85,7 +85,7 @@ module.exports = async function imageInputToBase64({ imageInput, maxWidth, mimeT
imageBase64Full: imageDataBase64,
imageName: imageName,
};
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Image Processing Error! =>", error.message);
return {

View File

@ -58,7 +58,7 @@ module.exports = async function inputFileToBase64({ inputFile, allowedRegex }) {
reader.onload = function () {
resolve(reader.result);
};
reader.onerror = function (error) {
reader.onerror = function (/** @type {*} */ error) {
console.log("Error: ", error.message);
};
});
@ -78,7 +78,7 @@ module.exports = async function inputFileToBase64({ inputFile, allowedRegex }) {
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("File Processing Error! =>", error.message);
return {

View File

@ -48,6 +48,6 @@ try {
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Dump Error: ", error.message);
}

View File

@ -67,7 +67,7 @@ module.exports = async function addUsersTableToDb({ dbSchema }) {
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log(error.message);
}
};

View File

@ -243,7 +243,7 @@ async function createDbFromSchema(dbSchema) {
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Error in createDbFromSchema => ", error.message);
}
}

View File

@ -113,7 +113,7 @@ module.exports = async function dbHandler({ query, values, database }) {
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("DB handler error:", error.message);
results = null;

View File

@ -72,7 +72,7 @@ module.exports = async function noDatabaseDbHandler({ query, values }) {
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("ERROR in noDatabaseDbHandler =>", error.message);
}

View File

@ -67,7 +67,7 @@ module.exports = async function parseDbResults({ unparsedResults, tableSchema })
* @description Declare "results" variable
*/
return parsedResults;
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("ERROR in parseDbResults Function =>", error.message);
return unparsedResults;
}

View File

@ -79,7 +79,7 @@ module.exports = async function updateTable({ dbFullName, tableName, tableInfoAr
////////////////////////////////////////
/**
* @type {DSQL_MYSQL_SHOW_INDEXES_Type[] | null}
* @type {*}
* @description All indexes from MYSQL db
*/
const allExistingIndexes = await varDatabaseDbHandler({
@ -88,7 +88,7 @@ module.exports = async function updateTable({ dbFullName, tableName, tableInfoAr
});
/**
* @type {DSQL_MYSQL_SHOW_COLUMNS_Type[] | null}
* @type {*}
* @description All columns from MYSQL db
*/
const allExistingColumns = await varDatabaseDbHandler({
@ -158,7 +158,7 @@ module.exports = async function updateTable({ dbFullName, tableName, tableInfoAr
upToDateTableFieldsArray = userSchemaData[targetDbIndex].tables[targetTableIndex].fields;
fs.writeFileSync(schemaPath, JSON.stringify(userSchemaData), "utf8");
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Error in updating Table =>", error.message);
}
@ -261,7 +261,7 @@ module.exports = async function updateTable({ dbFullName, tableName, tableInfoAr
/**
* @description All MSQL Foreign Keys
* @type {DSQL_MYSQL_FOREIGN_KEYS_Type[] | null}
* @type {*}
*/
const allForeignKeys = await varDatabaseDbHandler({
queryString: `SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_SCHEMA = '${dbFullName}' AND TABLE_NAME='${tableName}' AND CONSTRAINT_TYPE='FOREIGN KEY'`,
@ -443,7 +443,7 @@ module.exports = async function updateTable({ dbFullName, tableName, tableInfoAr
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log('Error in "updateTable" function =>', error.message);
return "Error in Updating Table";

View File

@ -30,7 +30,7 @@ module.exports = async function varReadOnlyDatabaseDbHandler({ queryString, data
results = await dbHandler({ query: queryString, values: queryValuesArray, database: database });
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
////////////////////////////////////////
console.log("\x1b[31mvarReadOnlyDatabaseDbHandler ERROR\x1b[0m =>", database, error.message);

View File

@ -69,7 +69,7 @@ async function localGet({ options, dbSchema }) {
return { success: true, payload: results };
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
////////////////////////////////////////
console.log("Error in local get Request =>", error.message);
@ -78,7 +78,7 @@ async function localGet({ options, dbSchema }) {
}
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
////////////////////////////////////////
console.log("Error in local get Request =>", error.message);

View File

@ -72,7 +72,7 @@ async function localPost({ options, dbSchema }) {
};
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
////////////////////////////////////////
return {
@ -83,7 +83,7 @@ async function localPost({ options, dbSchema }) {
}
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
////////////////////////////////////////
console.log("Error in local post Request =>", error.message);

View File

@ -127,7 +127,7 @@ async function updateApiSchemaFromLocalDb() {
/** ********************************************** */
return httpResponse;
} catch (error) {
} catch (/** @type {*} */ error) {
return {
success: false,
payload: null,

View File

@ -101,7 +101,7 @@ async function addDbEntry({ dbContext, paradigm, dbFullName, tableName, data, ta
}
insertValuesArray.push(value);
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("DSQL: Error in parsing data keys =>", error.message);
continue;
}

View File

@ -127,7 +127,7 @@ async function runQuery({ dbFullName, query, readOnly, dbSchema, queryValuesArra
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Error in Running Query =>", error.message);
result = null;
error = error.message;

View File

@ -96,7 +96,7 @@ async function updateDbEntry({ dbContext, paradigm, dbFullName, tableName, data,
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
////////////////////////////////////////
////////////////////////////////////////

View File

@ -135,7 +135,7 @@ async function localAddUser({ payload, dbSchema }) {
}
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
////////////////////////////////////////
console.log("Error in local add-user Request =>", error.message);

View File

@ -134,7 +134,7 @@ async function loginLocalUser({ payload, additionalFields, dbSchema }) {
};
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Error in local login-user Request =>", error.message);
return {
success: false,

View File

@ -93,7 +93,7 @@ async function localReauthUser({ existingUser, additionalFields, dbSchema }) {
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Error in local login-user Request =>", error.message);
return {
success: false,

View File

@ -119,7 +119,7 @@ async function localGithubAuth({ res, code, email, clientId, clientSecret, addit
return { ...loggedInGithubUser, dsqlUserId: "0" };
////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("localGithubAuth error", error.message);
return { success: false, msg: "Failed!" };

View File

@ -136,7 +136,7 @@ async function githubLogin({ code, clientId, clientSecret }) {
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////

View File

@ -258,7 +258,7 @@ async function handleSocialDb({ social_id, email, social_platform, payload, res,
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("ERROR in 'handleSocialDb.js' backend function =>", error.message);
return {

View File

@ -72,7 +72,7 @@ async function localUpdateUser({ payload, dbSchema }) {
success: true,
payload: updateUser,
};
} catch (error) {
} catch (/** @type {*} */ error) {
////////////////////////////////////////
console.log("Error in local add-user Request =>", error.message);

View File

@ -37,7 +37,7 @@ const decrypt = ({ encryptedString, encryptionKey, encryptionSalt }) => {
let decrypted = decipher.update(encryptedString, "hex", "utf8");
decrypted += decipher.final("utf8");
return decrypted;
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Error in decrypting =>", error.message);
return encryptedString;
}

View File

@ -36,7 +36,7 @@ const encrypt = ({ data, encryptionKey, encryptionSalt }) => {
let encrypted = cipher.update(data, "utf8", "hex");
encrypted += cipher.final("hex");
return encrypted;
} catch (error) {
} catch (/** @type {*} */ error) {
console.log("Error in encrypting =>", error.message);
return data;
}

22
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "datasquirel",
"version": "1.6.8",
"version": "1.7.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "datasquirel",
"version": "1.6.8",
"version": "1.7.0",
"license": "ISC",
"dependencies": {
"dotenv": "^16.3.1",
@ -16,8 +16,26 @@
"bin": {
"dsql-dump": "engine/dump.js",
"dsql-watch": "engine/dsql.js"
},
"devDependencies": {
"@types/mysql": "^2.15.21"
}
},
"node_modules/@types/mysql": {
"version": "2.15.21",
"resolved": "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.21.tgz",
"integrity": "sha512-NPotx5CVful7yB+qZbWtXL2fA4e7aEHkihHLjklc6ID8aq7bhguHgeIoC1EmSNTAuCgI6ZXrjt2ZSaXnYX0EUg==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": {
"version": "20.4.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.10.tgz",
"integrity": "sha512-vwzFiiy8Rn6E0MtA13/Cxxgpan/N6UeNYR9oUu6kuJWxu6zCk98trcDp8CBhbtaeuq9SykCmXkFr2lWLoPcvLg==",
"dev": true
},
"node_modules/agent-base": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "datasquirel",
"version": "1.7.0",
"version": "1.7.1",
"description": "Cloud-based SQL data management tool",
"main": "index.js",
"bin": {
@ -29,5 +29,8 @@
"dotenv": "^16.3.1",
"google-auth-library": "^9.0.0",
"mysql": "^2.18.1"
},
"devDependencies": {
"@types/mysql": "^2.15.21"
}
}

View File

@ -88,7 +88,7 @@ async function uploadImage({ key, url }) {
/** ********************************************** */
return httpResponse;
} catch (error) {
} catch (/** @type {*} */ error) {
/** ********************************************** */
/** ********************************************** */
/** ********************************************** */

View File

@ -93,7 +93,7 @@ async function uploadImage({ key, payload }) {
/** ********************************************** */
return httpResponse;
} catch (error) {
} catch (/** @type {*} */ error) {
/** ********************************************** */
/** ********************************************** */
/** ********************************************** */

View File

@ -95,7 +95,7 @@ async function uploadImage({ key, payload }) {
/** ********************************************** */
return httpResponse;
} catch (error) {
} catch (/** @type {*} */ error) {
/** ********************************************** */
/** ********************************************** */
/** ********************************************** */