Bugfix
This commit is contained in:
parent
e41224bab7
commit
1acdad97a2
@ -66,7 +66,6 @@ function reauthUser(_a) {
|
|||||||
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
|
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
|
||||||
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
|
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
|
||||||
global.DSQL_USE_LOCAL) {
|
global.DSQL_USE_LOCAL) {
|
||||||
/** @type {import("../../types").DSQL_DatabaseSchemaType | undefined} */
|
|
||||||
let dbSchema;
|
let dbSchema;
|
||||||
try {
|
try {
|
||||||
const localDbSchemaPath = path_1.default.resolve(process.cwd(), "dsql.schema.json");
|
const localDbSchemaPath = path_1.default.resolve(process.cwd(), "dsql.schema.json");
|
||||||
|
@ -19,9 +19,14 @@ const varDatabaseDbHandler_1 = __importDefault(require("../../backend/varDatabas
|
|||||||
*/
|
*/
|
||||||
function apiReauthUser(_a) {
|
function apiReauthUser(_a) {
|
||||||
return __awaiter(this, arguments, void 0, function* ({ existingUser, database, additionalFields, }) {
|
return __awaiter(this, arguments, void 0, function* ({ existingUser, database, additionalFields, }) {
|
||||||
|
const dbAppend = global.DSQL_USE_LOCAL
|
||||||
|
? ""
|
||||||
|
: database
|
||||||
|
? `${database}.`
|
||||||
|
: "";
|
||||||
let foundUser = (existingUser === null || existingUser === void 0 ? void 0 : existingUser.id) && existingUser.id.toString().match(/./)
|
let foundUser = (existingUser === null || existingUser === void 0 ? void 0 : existingUser.id) && existingUser.id.toString().match(/./)
|
||||||
? yield (0, varDatabaseDbHandler_1.default)({
|
? yield (0, varDatabaseDbHandler_1.default)({
|
||||||
queryString: `SELECT * FROM ${database}.users WHERE id=?`,
|
queryString: `SELECT * FROM ${dbAppend}users WHERE id=?`,
|
||||||
queryValuesArray: [existingUser.id.toString()],
|
queryValuesArray: [existingUser.id.toString()],
|
||||||
database,
|
database,
|
||||||
})
|
})
|
||||||
@ -35,7 +40,6 @@ function apiReauthUser(_a) {
|
|||||||
let csrfKey = Math.random().toString(36).substring(2) +
|
let csrfKey = Math.random().toString(36).substring(2) +
|
||||||
"-" +
|
"-" +
|
||||||
Math.random().toString(36).substring(2);
|
Math.random().toString(36).substring(2);
|
||||||
/** @type {import("../../../types").DATASQUIREL_LoggedInUser} */
|
|
||||||
let userPayload = {
|
let userPayload = {
|
||||||
id: foundUser[0].id,
|
id: foundUser[0].id,
|
||||||
first_name: foundUser[0].first_name,
|
first_name: foundUser[0].first_name,
|
||||||
|
@ -59,7 +59,6 @@ values) {
|
|||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(`connDbHandler Error: ${error.message}`);
|
console.log(`connDbHandler Error: ${error.message}`);
|
||||||
console.log(conn === null || conn === void 0 ? void 0 : conn.getConfig());
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
@ -92,7 +92,6 @@ export default async function reauthUser({
|
|||||||
DSQL_DB_NAME?.match(/./) &&
|
DSQL_DB_NAME?.match(/./) &&
|
||||||
global.DSQL_USE_LOCAL
|
global.DSQL_USE_LOCAL
|
||||||
) {
|
) {
|
||||||
/** @type {import("../../types").DSQL_DatabaseSchemaType | undefined} */
|
|
||||||
let dbSchema: import("../../types").DSQL_DatabaseSchemaType | undefined;
|
let dbSchema: import("../../types").DSQL_DatabaseSchemaType | undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -15,10 +15,16 @@ export default async function apiReauthUser({
|
|||||||
database,
|
database,
|
||||||
additionalFields,
|
additionalFields,
|
||||||
}: Param): Promise<APILoginFunctionReturn> {
|
}: Param): Promise<APILoginFunctionReturn> {
|
||||||
|
const dbAppend = global.DSQL_USE_LOCAL
|
||||||
|
? ""
|
||||||
|
: database
|
||||||
|
? `${database}.`
|
||||||
|
: "";
|
||||||
|
|
||||||
let foundUser =
|
let foundUser =
|
||||||
existingUser?.id && existingUser.id.toString().match(/./)
|
existingUser?.id && existingUser.id.toString().match(/./)
|
||||||
? await varDatabaseDbHandler({
|
? await varDatabaseDbHandler({
|
||||||
queryString: `SELECT * FROM ${database}.users WHERE id=?`,
|
queryString: `SELECT * FROM ${dbAppend}users WHERE id=?`,
|
||||||
queryValuesArray: [existingUser.id.toString()],
|
queryValuesArray: [existingUser.id.toString()],
|
||||||
database,
|
database,
|
||||||
})
|
})
|
||||||
@ -36,7 +42,6 @@ export default async function apiReauthUser({
|
|||||||
"-" +
|
"-" +
|
||||||
Math.random().toString(36).substring(2);
|
Math.random().toString(36).substring(2);
|
||||||
|
|
||||||
/** @type {import("../../../types").DATASQUIREL_LoggedInUser} */
|
|
||||||
let userPayload: import("../../../types").DATASQUIREL_LoggedInUser = {
|
let userPayload: import("../../../types").DATASQUIREL_LoggedInUser = {
|
||||||
id: foundUser[0].id,
|
id: foundUser[0].id,
|
||||||
first_name: foundUser[0].first_name,
|
first_name: foundUser[0].first_name,
|
||||||
|
@ -56,7 +56,6 @@ export default async function connDbHandler<ReturnType = any>(
|
|||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.log(`connDbHandler Error: ${error.message}`);
|
console.log(`connDbHandler Error: ${error.message}`);
|
||||||
console.log(conn?.getConfig());
|
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
conn?.end();
|
conn?.end();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "3.9.6",
|
"version": "3.9.7",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user