This commit is contained in:
Benjamin Toby
2025-08-04 08:20:32 +01:00
parent 71a8431de5
commit ab13c68c8e
18 changed files with 41 additions and 20 deletions
@@ -16,7 +16,7 @@ function encryptReserPasswordUrl({ email, encryptionKey, encryptionSalt, }) {
encryptionKey,
encryptionSalt,
});
const defaultUrlOrigin = `https://datasquirel.com`;
const defaultUrlOrigin = `https://www.datasquirel.com`;
let urlOrigin = process.env.DSQL_HOST || defaultUrlOrigin;
const url = `${defaultUrlOrigin}`;
}
+2 -2
View File
@@ -122,7 +122,7 @@ function addDbEntry(_a) {
function grabQueryValuesString(arr) {
return arr
.map((v, i) => {
if (v.toString().match(/VEC_FromText/i)) {
if (v === null || v === void 0 ? void 0 : v.toString().match(/VEC_FromText/i)) {
return v;
}
return "?";
@@ -131,7 +131,7 @@ function addDbEntry(_a) {
}
function grabFinalQueryValuesArr(arr) {
return arr
.filter((v) => !v.toString().match(/VEC_FromText/i))
.filter((v) => !(v === null || v === void 0 ? void 0 : v.toString().match(/VEC_FromText/i)))
.map((v) => String(v));
}
if (newData) {
@@ -6,5 +6,5 @@ interface SQLDeleteGenReturn {
/**
* # SQL Delete Generator
*/
export default function sqlDeleteGenerator({ tableName, deleteKeyValues, dbFullName, data, }: SQLDeleteGeneratorParams): SQLDeleteGenReturn | undefined;
export default function sqlDeleteGenerator({ tableName, deleteKeyValues, dbFullName, data, deleteKeyValuesOperator, }: SQLDeleteGeneratorParams): SQLDeleteGenReturn | undefined;
export {};
@@ -8,7 +8,7 @@ const sql_equality_parser_1 = __importDefault(require("../../../utils/sql-equali
/**
* # SQL Delete Generator
*/
function sqlDeleteGenerator({ tableName, deleteKeyValues, dbFullName, data, }) {
function sqlDeleteGenerator({ tableName, deleteKeyValues, dbFullName, data, deleteKeyValuesOperator, }) {
const finalDbName = dbFullName ? `${dbFullName}.` : "";
try {
let queryStr = `DELETE FROM ${finalDbName}${tableName}`;
@@ -41,7 +41,9 @@ function sqlDeleteGenerator({ tableName, deleteKeyValues, dbFullName, data, }) {
queryArr.push(parsedValue);
});
}
queryStr += ` WHERE ${deleteBatch.join(" AND ")}`;
if (deleteBatch.length) {
queryStr += ` WHERE ${deleteBatch.join(` ${deleteKeyValuesOperator || "AND"} `)}`;
}
return {
query: queryStr,
values: queryArr,
+2
View File
@@ -1228,6 +1228,7 @@ export type SQLDeleteGeneratorParams<T extends {
}> = {
tableName: string;
deleteKeyValues?: SQLDeleteData<T>[];
deleteKeyValuesOperator?: "AND" | "OR";
dbFullName?: string;
data?: any;
};
@@ -1251,6 +1252,7 @@ export type DsqlCrudParam<T extends {
batchData?: T[];
deleteData?: T;
deleteKeyValues?: SQLDeleteData[];
deleteKeyValuesOperator?: "AND" | "OR";
targetId?: string | number;
targetValue?: string | number;
targetField?: keyof T;
+2 -1
View File
@@ -20,7 +20,7 @@ const addDbEntry_1 = __importDefault(require("../../functions/backend/db/addDbEn
const updateDbEntry_1 = __importDefault(require("../../functions/backend/db/updateDbEntry"));
function dsqlCrud(params) {
return __awaiter(this, void 0, void 0, function* () {
const { action, data, table, targetValue, sanitize, targetField, targetId, dbFullName, deleteData, batchData, deleteKeyValues, debug, tableSchema, } = params;
const { action, data, table, targetValue, sanitize, targetField, targetId, dbFullName, deleteData, batchData, deleteKeyValues, debug, tableSchema, deleteKeyValuesOperator, } = params;
const finalData = (sanitize ? sanitize({ data }) : data);
const finalBatchData = (sanitize ? sanitize({ batchData }) : batchData);
switch (action) {
@@ -60,6 +60,7 @@ function dsqlCrud(params) {
tableName: table,
dbFullName,
deleteKeyValues,
deleteKeyValuesOperator,
});
const res = (yield (0, conn_db_handler_1.default)(undefined, deleteQuery === null || deleteQuery === void 0 ? void 0 : deleteQuery.query, deleteQuery === null || deleteQuery === void 0 ? void 0 : deleteQuery.values));
return {
@@ -43,6 +43,9 @@ function dataTypeConstructor(dataType, limit, decimal) {
if (finalType == "VARCHAR") {
return (finalType += `(${limit || 250})`);
}
if (finalType == "VECTOR") {
return (finalType += `(${limit || 120})`);
}
if (finalType == "DECIMAL" ||
finalType == "FLOAT" ||
finalType == "DOUBLE") {
+1 -1
View File
@@ -28,7 +28,7 @@ function grabHostNames(param) {
? finalEnv["DSQL_API_REMOTE_HOST_PORT"]
: undefined;
return {
host: remoteHost || localHost || "datasquirel.com",
host: remoteHost || localHost || "www.datasquirel.com",
port: remoteHostPort || localHostPort || 443,
scheme: (scheme === null || scheme === void 0 ? void 0 : scheme.match(/^http$/i)) ? http_1.default : https_1.default,
user_id: (param === null || param === void 0 ? void 0 : param.userId) || String(finalEnv["DSQL_API_USER_ID"] || 0),
+3 -3
View File
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.default = grabDSQLRemoteURLs;
function grabDSQLRemoteURLs() {
const communityTarballURL = "https://static.datasquirel.com/images/user-images/user-2/dsql/distro/dsql-community.tar.xz";
const communityTarballShortURL = "https://datasquirel.com/api/media/dsql-community";
const installScriptURL = "https://datasquirel.com/api/media/install";
const updateScriptURL = "https://datasquirel.com/api/media/update";
const communityTarballShortURL = "https://www.datasquirel.com/api/media/dsql-community";
const installScriptURL = "https://www.datasquirel.com/api/media/install";
const updateScriptURL = "https://www.datasquirel.com/api/media/update";
return {
communityTarballURL,
communityTarballShortURL,