This commit is contained in:
Benjamin Toby 2025-02-05 19:34:03 +01:00
parent 1acdad97a2
commit 06de31dcb2
10 changed files with 23 additions and 15 deletions

View File

@ -69,6 +69,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false,
payload: null,
msg: "Couldn't Decrypt cookie",
cookieNames: keyNames,
};
}
/**
@ -86,6 +87,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false,
payload: null,
msg: "No CSRF_K in decrypted payload",
cookieNames: keyNames,
};
}
if (!(0, write_auth_files_1.checkAuthFile)(userObject.csrf_k)) {
@ -93,6 +95,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false,
payload: null,
msg: "Auth file doesn't exist",
cookieNames: keyNames,
};
}
/**
@ -107,6 +110,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false,
payload: null,
msg: "CSRF_K mismatch",
cookieNames: keyNames,
};
}
}
@ -117,6 +121,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false,
payload: null,
msg: "Payload Creation Date is not a number",
cookieNames: keyNames,
};
}
const timeElapsed = Date.now() - payloadCreationDate;
@ -128,6 +133,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
success: false,
payload: null,
msg: "Session has expired",
cookieNames: keyNames,
};
}
/**

View File

@ -41,7 +41,6 @@ function sqlGenerator({ tableName, genObject, dbFullName }) {
}
}
else if (Array.isArray(queryObj.value)) {
/** @type {string[]} */
const strArray = [];
queryObj.value.forEach((val) => {
const valueParsed = val;
@ -62,13 +61,11 @@ function sqlGenerator({ tableName, genObject, dbFullName }) {
return str;
}
const sqlSearhString = queryKeys === null || queryKeys === void 0 ? void 0 : queryKeys.map((field) => {
const queryObj =
/** @type {import("../../../types").ServerQueryQueryObject} */ finalQuery === null || finalQuery === void 0 ? void 0 : finalQuery[field];
const queryObj = finalQuery === null || finalQuery === void 0 ? void 0 : finalQuery[field];
if (!queryObj)
return;
if (queryObj.__query) {
const subQueryGroup =
/** @type {import("../../../types").ServerQueryQueryObject}} */ queryObj.__query;
const subQueryGroup = queryObj.__query;
const subSearchKeys = Object.keys(subQueryGroup);
const subSearchString = subSearchKeys.map((_field) => {
const newSubQueryObj = subQueryGroup === null || subQueryGroup === void 0 ? void 0 : subQueryGroup[_field];

View File

@ -55,6 +55,9 @@ export declare const TextFieldTypesArray: readonly [{
}, {
readonly title: "Javascript";
readonly value: "javascript";
}, {
readonly title: "Shell";
readonly value: "shell";
}];
export type DSQL_FieldSchemaType = {
fieldName?: string;

View File

@ -9,6 +9,7 @@ exports.TextFieldTypesArray = [
{ title: "HTML", value: "html" },
{ title: "CSS", value: "css" },
{ title: "Javascript", value: "javascript" },
{ title: "Shell", value: "shell" },
];
exports.ServerQueryOperators = ["AND", "OR"];
exports.ServerQueryEqualities = ["EQUAL", "LIKE", "NOT EQUAL"];

View File

@ -9,7 +9,6 @@ import {
DSQL_DatabaseSchemaType,
GetReqQueryObject,
GetReturn,
ServerQueryParam,
} from "../types";
import apiGetGrabQueryAndValues from "../utils/grab-query-and-values";

View File

@ -105,6 +105,7 @@ export default function userAuth({
success: false,
payload: null,
msg: "Couldn't Decrypt cookie",
cookieNames: keyNames,
};
}
@ -127,6 +128,7 @@ export default function userAuth({
success: false,
payload: null,
msg: "No CSRF_K in decrypted payload",
cookieNames: keyNames,
};
}
@ -135,6 +137,7 @@ export default function userAuth({
success: false,
payload: null,
msg: "Auth file doesn't exist",
cookieNames: keyNames,
};
}
@ -152,6 +155,7 @@ export default function userAuth({
success: false,
payload: null,
msg: "CSRF_K mismatch",
cookieNames: keyNames,
};
}
}
@ -166,6 +170,7 @@ export default function userAuth({
success: false,
payload: null,
msg: "Payload Creation Date is not a number",
cookieNames: keyNames,
};
}
@ -180,6 +185,7 @@ export default function userAuth({
success: false,
payload: null,
msg: "Session has expired",
cookieNames: keyNames,
};
}

View File

@ -1,4 +1,4 @@
import fs, { glob } from "fs";
import fs from "fs";
import handleNodemailer from "../../backend/handleNodemailer";
import path from "path";
import addMariadbUser from "../../backend/addMariadbUser";

View File

@ -73,7 +73,6 @@ export default function sqlGenerator<
sqlSearhValues.push(valueParsed);
}
} else if (Array.isArray(queryObj.value)) {
/** @type {string[]} */
const strArray: string[] = [];
queryObj.value.forEach((val) => {
const valueParsed = val;
@ -97,15 +96,11 @@ export default function sqlGenerator<
}
const sqlSearhString = queryKeys?.map((field) => {
const queryObj =
/** @type {import("../../../types").ServerQueryQueryObject} */ finalQuery?.[
field
];
const queryObj = finalQuery?.[field];
if (!queryObj) return;
if (queryObj.__query) {
const subQueryGroup =
/** @type {import("../../../types").ServerQueryQueryObject}} */ queryObj.__query;
const subQueryGroup = queryObj.__query;
const subSearchKeys = Object.keys(subQueryGroup);
const subSearchString = subSearchKeys.map((_field) => {

View File

@ -49,6 +49,7 @@ export const TextFieldTypesArray = [
{ title: "HTML", value: "html" },
{ title: "CSS", value: "css" },
{ title: "Javascript", value: "javascript" },
{ title: "Shell", value: "shell" },
] as const;
export type DSQL_FieldSchemaType = {

View File

@ -1,6 +1,6 @@
{
"name": "@moduletrace/datasquirel",
"version": "3.9.7",
"version": "3.9.8",
"description": "Cloud-based SQL data management tool",
"main": "dist/index.js",
"bin": {