diff --git a/engine/engine/utils/parseDbResults.js b/engine/engine/utils/parseDbResults.js index 5ec7cb4..e893751 100644 --- a/engine/engine/utils/parseDbResults.js +++ b/engine/engine/utils/parseDbResults.js @@ -1,6 +1,7 @@ // @ts-check const decrypt = require("../../../functions/decrypt"); +// @ts-ignore const defaultFieldsRegexp = require("./defaultFieldsRegexp"); /** diff --git a/engine/query/utils/updateDbEntry.js b/engine/query/utils/updateDbEntry.js index 3d8ee2b..74eca6d 100644 --- a/engine/query/utils/updateDbEntry.js +++ b/engine/query/utils/updateDbEntry.js @@ -20,7 +20,7 @@ const dbHandler = require("../../engine/utils/dbHandler"); * "Read only" or "Full Access"? Defaults to "Read Only" * @param {string} params.dbFullName - Database full name * @param {string} params.tableName - Table name - * @param {object} params.data - Data to add + * @param {*} params.data - Data to add * @param {import("../../../types/database-schema.td").DSQL_TableSchemaType} [params.tableSchema] - Table schema * @param {string} params.identifierColumnName - Update row identifier column name * @param {string | number} params.identifierValue - Update row identifier column value diff --git a/engine/user/login-user.js b/engine/user/login-user.js index bf60f73..f546017 100644 --- a/engine/user/login-user.js +++ b/engine/user/login-user.js @@ -117,6 +117,7 @@ async function loginLocalUser({ payload, additionalFields, dbSchema }) { if (additionalFields && Array.isArray(additionalFields) && additionalFields.length > 0) { additionalFields.forEach((key) => { + // @ts-ignore userPayload[key] = foundUser?.[0][key]; }); } diff --git a/engine/user/reauth-user.js b/engine/user/reauth-user.js index 4428a9b..5b18578 100644 --- a/engine/user/reauth-user.js +++ b/engine/user/reauth-user.js @@ -74,6 +74,7 @@ async function localReauthUser({ existingUser, additionalFields, dbSchema }) { if (additionalFields && Array.isArray(additionalFields) && additionalFields.length > 0) { additionalFields.forEach((key) => { + // @ts-ignore userPayload[key] = foundUser?.[0][key]; }); } diff --git a/engine/user/social/github-auth.js b/engine/user/social/github-auth.js index b302681..63a2a37 100644 --- a/engine/user/social/github-auth.js +++ b/engine/user/social/github-auth.js @@ -96,6 +96,7 @@ async function localGithubAuth({ res, code, email, clientId, clientSecret, addit if (additionalFields && Object.keys(additionalFields).length > 0) { Object.keys(additionalFields).forEach((key) => { + // @ts-ignore payload[key] = additionalFields[key]; }); } diff --git a/engine/user/social/google-auth.js b/engine/user/social/google-auth.js index c628dde..97d7b5f 100644 --- a/engine/user/social/google-auth.js +++ b/engine/user/social/google-auth.js @@ -122,6 +122,7 @@ async function localGoogleAuth({ dbSchema, token, clientId, response, additional if (additionalFields && Object.keys(additionalFields).length > 0) { Object.keys(additionalFields).forEach((key) => { + // @ts-ignore payloadObject[key] = additionalFields[key]; }); } diff --git a/engine/user/social/utils/handleSocialDb.js b/engine/user/social/utils/handleSocialDb.js index 2c5de6e..1142ee9 100644 --- a/engine/user/social/utils/handleSocialDb.js +++ b/engine/user/social/utils/handleSocialDb.js @@ -71,7 +71,7 @@ const encryptionSalt = process.env.DSQL_ENCRYPTION_SALT || ""; * image_thumbnail: string, * username: string, * }, - * res: object|null, + * res: http.ServerResponse, * invitation?: object|null, * supEmail?: string | null, * additionalFields?: object, @@ -99,7 +99,6 @@ async function handleSocialDb({ social_id, email, social_platform, payload, res, user: existingSocialIdUser[0], social_platform, res, - invitation, database, additionalFields, }); @@ -154,7 +153,6 @@ async function handleSocialDb({ social_id, email, social_platform, payload, res, user: payload, social_platform, res, - invitation, database, additionalFields, }); @@ -177,6 +175,7 @@ async function handleSocialDb({ social_id, email, social_platform, payload, res, }; Object.keys(payload).forEach((key) => { + // @ts-ignore data[key] = payload[key]; }); @@ -236,7 +235,6 @@ async function handleSocialDb({ social_id, email, social_platform, payload, res, user: newUserQueried[0], social_platform, res, - invitation, database, additionalFields, }); @@ -303,7 +301,6 @@ async function handleSocialDb({ social_id, email, social_platform, payload, res, * }} params.user - user object * @param {string} params.social_platform - Whether its "google" or "facebook" or "github" * @param {http.ServerResponse} params.res - Https response object - * @param {object} params.invitation - A query object if user was invited * @param {string|null} params.database - Target Database * @param {object} [params.additionalFields] - Additional fields to be added to the user payload * @@ -313,7 +310,7 @@ async function handleSocialDb({ social_id, email, social_platform, payload, res, * msg?: string * }>} */ -async function loginSocialUser({ user, social_platform, res, invitation, database, additionalFields }) { +async function loginSocialUser({ user, social_platform, res, database, additionalFields }) { const foundUser = await varDatabaseDbHandler({ database: database ? database : "datasquirel", queryString: `SELECT * FROM users WHERE email='${user.email}' AND social_id='${user.social_id}' AND social_platform='${social_platform}'`, @@ -350,6 +347,7 @@ async function loginSocialUser({ user, social_platform, res, invitation, databas if (additionalFields && Object.keys(additionalFields).length > 0) { Object.keys(additionalFields).forEach((key) => { + // @ts-ignore userPayload[key] = foundUser[0][key]; }); } diff --git a/engine/user/social/utils/httpsRequest.js b/engine/user/social/utils/httpsRequest.js index c32e0e7..c050aac 100644 --- a/engine/user/social/utils/httpsRequest.js +++ b/engine/user/social/utils/httpsRequest.js @@ -1,5 +1,3 @@ -// @ts-check - /** * Imports * ============================================================================== diff --git a/engine/user/update-user.js b/engine/user/update-user.js index 51128cb..3ce506e 100644 --- a/engine/user/update-user.js +++ b/engine/user/update-user.js @@ -47,6 +47,7 @@ async function localUpdateUser({ payload, dbSchema }) { reqBodyKeys.forEach((key) => { if (key?.match(/^date_|^id$/)) return; + // @ts-ignore finalData[key] = payload[key]; }); diff --git a/package.json b/package.json index 500832a..d1bdb5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.7.2", + "version": "1.7.3", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": { diff --git a/users/social/github-auth.js b/users/social/github-auth.js index 3cd50a9..c67ec35 100644 --- a/users/social/github-auth.js +++ b/users/social/github-auth.js @@ -43,7 +43,7 @@ const localGithubAuth = require("../../engine/user/social/github-auth"); * @param {http.ServerResponse} params.response - HTTPS response object * @param {string} params.encryptionKey - Encryption key * @param {string} params.encryptionSalt - Encryption salt - * @param {object} [params.additionalFields] - Additional Fields to be added to the user object + * @param {string[]} [params.additionalFields] - Additional Fields to be added to the user object * * @returns { Promise } */