From 2804f8523639726e7efdf2185b58517983f1c2eb Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Sat, 19 Oct 2024 17:50:33 +0100 Subject: [PATCH] Update types --- engine/engine/createDbFromSchema.js | 4 ++-- engine/engine/utils/createTable.js | 2 +- engine/engine/utils/dbHandler.js | 2 +- engine/engine/utils/generateColumnDescription.js | 2 +- engine/engine/utils/parseDbResults.js | 2 +- engine/engine/utils/supplementTable.js | 2 +- engine/engine/utils/updateTable.js | 10 +++++----- engine/user/get-user.js | 2 +- engine/user/reauth-user.js | 2 +- engine/user/send-email-code.js | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/engine/engine/createDbFromSchema.js b/engine/engine/createDbFromSchema.js index 89e104b..a269284 100644 --- a/engine/engine/createDbFromSchema.js +++ b/engine/engine/createDbFromSchema.js @@ -27,7 +27,7 @@ const updateTable = require("./utils/updateTable"); * runs the "dsql create" command. `NOTE`: there must be a "dsql.schema.json" file * in the root of the project for this function to work * - * @param {DSQL_DatabaseSchemaType | undefined} dbSchema - An array of database schema objects + * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} dbSchema - An array of database schema objects */ async function createDbFromSchema(dbSchema) { try { @@ -42,7 +42,7 @@ async function createDbFromSchema(dbSchema) { } for (let i = 0; i < dbSchema.length; i++) { - /** @type {DSQL_DatabaseSchemaType | undefined} */ + /** @type {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} */ const database = dbSchema[i]; if (!database) { diff --git a/engine/engine/utils/createTable.js b/engine/engine/utils/createTable.js index 874c64c..80d6db6 100644 --- a/engine/engine/utils/createTable.js +++ b/engine/engine/utils/createTable.js @@ -17,7 +17,7 @@ const supplementTable = require("./supplementTable"); * @param {string} param0.tableName * @param {any[]} param0.tableInfoArray * @param {(params: import("./varDatabaseDbHandler").VarDbHandlerParam)=>any} param0.varDatabaseDbHandler - * @param {DSQL_DatabaseSchemaType} [param0.dbSchema] + * @param {import("../../../package-shared/types").DSQL_DatabaseSchemaType} [param0.dbSchema] * @returns */ module.exports = async function createTable({ diff --git a/engine/engine/utils/dbHandler.js b/engine/engine/utils/dbHandler.js index 7daa4bb..222ecd7 100644 --- a/engine/engine/utils/dbHandler.js +++ b/engine/engine/utils/dbHandler.js @@ -65,7 +65,7 @@ const connection = mysql.createConnection({ * @param {object} params - Single Param object containing params * @param {string} params.query - Query String * @param {(string | number)[]} [params.values] - Values - * @param {DSQL_DatabaseSchemaType} [params.dbSchema] - Database Schema + * @param {import("../../../package-shared/types").DSQL_DatabaseSchemaType} [params.dbSchema] - Database Schema * @param {string} [params.database] - Target Database * @param {string} [params.tableName] - Target Table Name * diff --git a/engine/engine/utils/generateColumnDescription.js b/engine/engine/utils/generateColumnDescription.js index e2dd0b9..1f28112 100644 --- a/engine/engine/utils/generateColumnDescription.js +++ b/engine/engine/utils/generateColumnDescription.js @@ -11,7 +11,7 @@ * Generate SQL text for Field * ============================================================================== * @param {object} params - Single object params - * @param {DSQL_FieldSchemaType} params.columnData - Field object + * @param {import("../../../package-shared/types").DSQL_FieldSchemaType} params.columnData - Field object * @param {boolean} [params.primaryKeySet] - Table Name(slug) * * @returns {{fieldEntryText: string, newPrimaryKeySet: boolean}} diff --git a/engine/engine/utils/parseDbResults.js b/engine/engine/utils/parseDbResults.js index 30bd39c..f78fa7b 100644 --- a/engine/engine/utils/parseDbResults.js +++ b/engine/engine/utils/parseDbResults.js @@ -14,7 +14,7 @@ const defaultFieldsRegexp = require("./defaultFieldsRegexp"); * @param {object} params - Single object params * @param {*[]} params.unparsedResults - Array of data objects containing Fields(keys) * and corresponding values of the fields(values) - * @param {DSQL_TableSchemaType} [params.tableSchema] - Table schema + * @param {import("../../../package-shared/types").DSQL_TableSchemaType} [params.tableSchema] - Table schema * @returns {Promise} */ module.exports = async function parseDbResults({ diff --git a/engine/engine/utils/supplementTable.js b/engine/engine/utils/supplementTable.js index c730f6c..2d238e4 100644 --- a/engine/engine/utils/supplementTable.js +++ b/engine/engine/utils/supplementTable.js @@ -10,7 +10,7 @@ /** * * @param {object} param0 - * @param {DSQL_FieldSchemaType[]} param0.tableInfoArray + * @param {import("../../../package-shared/types").DSQL_FieldSchemaType[]} param0.tableInfoArray * @returns */ module.exports = function supplementTable({ tableInfoArray }) { diff --git a/engine/engine/utils/updateTable.js b/engine/engine/utils/updateTable.js index dd95b5b..f07de4b 100644 --- a/engine/engine/utils/updateTable.js +++ b/engine/engine/utils/updateTable.js @@ -31,9 +31,9 @@ const schemaPath = path.resolve(process.cwd(), "dsql.schema.json"); * @param {object} params - Single object params * @param {string} params.dbFullName - Database full name => "datasquirel_user_4394_db_name" * @param {string} params.tableName - Table Name(slug) - * @param {DSQL_FieldSchemaType[]} params.tableInfoArray - Table Info Array - * @param {DSQL_DatabaseSchemaType[]} params.dbSchema - Single post - * @param {DSQL_IndexSchemaType[]} [params.tableIndexes] - Table Indexes + * @param {import("../../../package-shared/types").DSQL_FieldSchemaType[]} params.tableInfoArray - Table Info Array + * @param {import("../../../package-shared/types").DSQL_DatabaseSchemaType[]} params.dbSchema - Single post + * @param {import("../../../package-shared/types").DSQL_IndexSchemaType[]} [params.tableIndexes] - Table Indexes * @param {boolean} [params.clone] - Is this a newly cloned table? * @param {number} [params.tableIndex] - The number index of the table in the dbSchema array * @@ -88,7 +88,7 @@ module.exports = async function updateTable({ //////////////////////////////////////// /** - * @type {DSQL_MYSQL_SHOW_INDEXES_Type[]} + * @type {import("../../../package-shared/types").DSQL_MYSQL_SHOW_INDEXES_Type[]} * @description All indexes from MYSQL db */ const allExistingIndexes = await varDatabaseDbHandler({ @@ -97,7 +97,7 @@ module.exports = async function updateTable({ }); /** - * @type {DSQL_MYSQL_SHOW_COLUMNS_Type[]} + * @type {import("../../../package-shared/types").DSQL_MYSQL_SHOW_COLUMNS_Type[]} * @description All columns from MYSQL db */ const allExistingColumns = await varDatabaseDbHandler({ diff --git a/engine/user/get-user.js b/engine/user/get-user.js index 00171c3..71f33e4 100644 --- a/engine/user/get-user.js +++ b/engine/user/get-user.js @@ -7,7 +7,7 @@ const varDatabaseDbHandler = require("../engine/utils/varDatabaseDbHandler"); * @param {object} param0 * @param {number} param0.userId * @param {string[]} param0.fields - * @param {DSQL_DatabaseSchemaType | undefined} [param0.dbSchema] + * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [param0.dbSchema] * @returns */ async function getLocalUser({ userId, fields, dbSchema }) { diff --git a/engine/user/reauth-user.js b/engine/user/reauth-user.js index b900985..dab5a54 100644 --- a/engine/user/reauth-user.js +++ b/engine/user/reauth-user.js @@ -7,7 +7,7 @@ const varDatabaseDbHandler = require("../engine/utils/varDatabaseDbHandler"); * @param {object} param0 * @param {*} param0.existingUser * @param {string[]} [param0.additionalFields] - * @param {DSQL_DatabaseSchemaType | undefined} [param0.dbSchema] + * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [param0.dbSchema] * @returns */ async function localReauthUser({ existingUser, additionalFields, dbSchema }) { diff --git a/engine/user/send-email-code.js b/engine/user/send-email-code.js index 4ac066d..a613f2d 100644 --- a/engine/user/send-email-code.js +++ b/engine/user/send-email-code.js @@ -10,7 +10,7 @@ const path = require("path"); * * @param {object} param0 * @param {string} param0.email - * @param {DSQL_DatabaseSchemaType | undefined} [param0.dbSchema] + * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [param0.dbSchema] * @param {string} param0.email_login_field * @param {string} [param0.mail_domain] * @param {string} [param0.mail_username]