Update types

This commit is contained in:
Benjamin Toby 2024-10-19 17:50:33 +01:00
parent 4462ba315d
commit 2804f85236
10 changed files with 15 additions and 15 deletions

View File

@ -27,7 +27,7 @@ const updateTable = require("./utils/updateTable");
* runs the "dsql create" command. `NOTE`: there must be a "dsql.schema.json" file * 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 * 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) { async function createDbFromSchema(dbSchema) {
try { try {
@ -42,7 +42,7 @@ async function createDbFromSchema(dbSchema) {
} }
for (let i = 0; i < dbSchema.length; i++) { for (let i = 0; i < dbSchema.length; i++) {
/** @type {DSQL_DatabaseSchemaType | undefined} */ /** @type {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
const database = dbSchema[i]; const database = dbSchema[i];
if (!database) { if (!database) {

View File

@ -17,7 +17,7 @@ const supplementTable = require("./supplementTable");
* @param {string} param0.tableName * @param {string} param0.tableName
* @param {any[]} param0.tableInfoArray * @param {any[]} param0.tableInfoArray
* @param {(params: import("./varDatabaseDbHandler").VarDbHandlerParam)=>any} param0.varDatabaseDbHandler * @param {(params: import("./varDatabaseDbHandler").VarDbHandlerParam)=>any} param0.varDatabaseDbHandler
* @param {DSQL_DatabaseSchemaType} [param0.dbSchema] * @param {import("../../../package-shared/types").DSQL_DatabaseSchemaType} [param0.dbSchema]
* @returns * @returns
*/ */
module.exports = async function createTable({ module.exports = async function createTable({

View File

@ -65,7 +65,7 @@ const connection = mysql.createConnection({
* @param {object} params - Single Param object containing params * @param {object} params - Single Param object containing params
* @param {string} params.query - Query String * @param {string} params.query - Query String
* @param {(string | number)[]} [params.values] - Values * @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.database] - Target Database
* @param {string} [params.tableName] - Target Table Name * @param {string} [params.tableName] - Target Table Name
* *

View File

@ -11,7 +11,7 @@
* Generate SQL text for Field * Generate SQL text for Field
* ============================================================================== * ==============================================================================
* @param {object} params - Single object params * @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) * @param {boolean} [params.primaryKeySet] - Table Name(slug)
* *
* @returns {{fieldEntryText: string, newPrimaryKeySet: boolean}} * @returns {{fieldEntryText: string, newPrimaryKeySet: boolean}}

View File

@ -14,7 +14,7 @@ const defaultFieldsRegexp = require("./defaultFieldsRegexp");
* @param {object} params - Single object params * @param {object} params - Single object params
* @param {*[]} params.unparsedResults - Array of data objects containing Fields(keys) * @param {*[]} params.unparsedResults - Array of data objects containing Fields(keys)
* and corresponding values of the fields(values) * 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<object[]|null>} * @returns {Promise<object[]|null>}
*/ */
module.exports = async function parseDbResults({ module.exports = async function parseDbResults({

View File

@ -10,7 +10,7 @@
/** /**
* *
* @param {object} param0 * @param {object} param0
* @param {DSQL_FieldSchemaType[]} param0.tableInfoArray * @param {import("../../../package-shared/types").DSQL_FieldSchemaType[]} param0.tableInfoArray
* @returns * @returns
*/ */
module.exports = function supplementTable({ tableInfoArray }) { module.exports = function supplementTable({ tableInfoArray }) {

View File

@ -31,9 +31,9 @@ const schemaPath = path.resolve(process.cwd(), "dsql.schema.json");
* @param {object} params - Single object params * @param {object} params - Single object params
* @param {string} params.dbFullName - Database full name => "datasquirel_user_4394_db_name" * @param {string} params.dbFullName - Database full name => "datasquirel_user_4394_db_name"
* @param {string} params.tableName - Table Name(slug) * @param {string} params.tableName - Table Name(slug)
* @param {DSQL_FieldSchemaType[]} params.tableInfoArray - Table Info Array * @param {import("../../../package-shared/types").DSQL_FieldSchemaType[]} params.tableInfoArray - Table Info Array
* @param {DSQL_DatabaseSchemaType[]} params.dbSchema - Single post * @param {import("../../../package-shared/types").DSQL_DatabaseSchemaType[]} params.dbSchema - Single post
* @param {DSQL_IndexSchemaType[]} [params.tableIndexes] - Table Indexes * @param {import("../../../package-shared/types").DSQL_IndexSchemaType[]} [params.tableIndexes] - Table Indexes
* @param {boolean} [params.clone] - Is this a newly cloned table? * @param {boolean} [params.clone] - Is this a newly cloned table?
* @param {number} [params.tableIndex] - The number index of the table in the dbSchema array * @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 * @description All indexes from MYSQL db
*/ */
const allExistingIndexes = await varDatabaseDbHandler({ 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 * @description All columns from MYSQL db
*/ */
const allExistingColumns = await varDatabaseDbHandler({ const allExistingColumns = await varDatabaseDbHandler({

View File

@ -7,7 +7,7 @@ const varDatabaseDbHandler = require("../engine/utils/varDatabaseDbHandler");
* @param {object} param0 * @param {object} param0
* @param {number} param0.userId * @param {number} param0.userId
* @param {string[]} param0.fields * @param {string[]} param0.fields
* @param {DSQL_DatabaseSchemaType | undefined} [param0.dbSchema] * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [param0.dbSchema]
* @returns * @returns
*/ */
async function getLocalUser({ userId, fields, dbSchema }) { async function getLocalUser({ userId, fields, dbSchema }) {

View File

@ -7,7 +7,7 @@ const varDatabaseDbHandler = require("../engine/utils/varDatabaseDbHandler");
* @param {object} param0 * @param {object} param0
* @param {*} param0.existingUser * @param {*} param0.existingUser
* @param {string[]} [param0.additionalFields] * @param {string[]} [param0.additionalFields]
* @param {DSQL_DatabaseSchemaType | undefined} [param0.dbSchema] * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [param0.dbSchema]
* @returns * @returns
*/ */
async function localReauthUser({ existingUser, additionalFields, dbSchema }) { async function localReauthUser({ existingUser, additionalFields, dbSchema }) {

View File

@ -10,7 +10,7 @@ const path = require("path");
* *
* @param {object} param0 * @param {object} param0
* @param {string} param0.email * @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.email_login_field
* @param {string} [param0.mail_domain] * @param {string} [param0.mail_domain]
* @param {string} [param0.mail_username] * @param {string} [param0.mail_username]