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
@@ -28,7 +28,7 @@ export default function encryptReserPasswordUrl({
encryptionSalt,
});
const defaultUrlOrigin = `https://datasquirel.com`;
const defaultUrlOrigin = `https://www.datasquirel.com`;
let urlOrigin = process.env.DSQL_HOST || defaultUrlOrigin;
const url = `${defaultUrlOrigin}`;
@@ -179,7 +179,7 @@ export default async function addDbEntry<
function grabQueryValuesString(arr: (string | number)[]) {
return arr
.map((v, i) => {
if (v.toString().match(/VEC_FromText/i)) {
if (v?.toString().match(/VEC_FromText/i)) {
return v;
}
return "?";
@@ -189,7 +189,7 @@ export default async function addDbEntry<
function grabFinalQueryValuesArr(arr: (string | number)[]) {
return arr
.filter((v) => !v.toString().match(/VEC_FromText/i))
.filter((v) => !v?.toString().match(/VEC_FromText/i))
.map((v) => String(v));
}
@@ -14,6 +14,7 @@ export default function sqlDeleteGenerator({
deleteKeyValues,
dbFullName,
data,
deleteKeyValuesOperator,
}: SQLDeleteGeneratorParams): SQLDeleteGenReturn | undefined {
const finalDbName = dbFullName ? `${dbFullName}.` : "";
@@ -54,7 +55,11 @@ export default function sqlDeleteGenerator({
});
}
queryStr += ` WHERE ${deleteBatch.join(" AND ")}`;
if (deleteBatch.length) {
queryStr += ` WHERE ${deleteBatch.join(
` ${deleteKeyValuesOperator || "AND"} `
)}`;
}
return {
query: queryStr,
+2
View File
@@ -1442,6 +1442,7 @@ export type SQLDeleteGeneratorParams<
> = {
tableName: string;
deleteKeyValues?: SQLDeleteData<T>[];
deleteKeyValuesOperator?: "AND" | "OR";
dbFullName?: string;
data?: any;
};
@@ -1464,6 +1465,7 @@ export type DsqlCrudParam<
batchData?: T[];
deleteData?: T;
deleteKeyValues?: SQLDeleteData[];
deleteKeyValuesOperator?: "AND" | "OR";
targetId?: string | number;
targetValue?: string | number;
targetField?: keyof T;
@@ -27,6 +27,7 @@ export default async function dsqlCrud<
deleteKeyValues,
debug,
tableSchema,
deleteKeyValuesOperator,
} = params;
const finalData = (sanitize ? sanitize({ data }) : data) as T;
@@ -77,6 +78,7 @@ export default async function dsqlCrud<
tableName: table,
dbFullName,
deleteKeyValues,
deleteKeyValuesOperator,
});
const res = (await connDbHandler(
@@ -15,6 +15,10 @@ export default function dataTypeConstructor(
return (finalType += `(${limit || 250})`);
}
if (finalType == "VECTOR") {
return (finalType += `(${limit || 120})`);
}
if (
finalType == "DECIMAL" ||
finalType == "FLOAT" ||
+1 -1
View File
@@ -42,7 +42,7 @@ export default function grabHostNames(param?: Param): GrabHostNamesReturn {
: undefined;
return {
host: remoteHost || localHost || "datasquirel.com",
host: remoteHost || localHost || "www.datasquirel.com",
port: remoteHostPort || localHostPort || 443,
scheme: scheme?.match(/^http$/i) ? http : https,
user_id: param?.userId || String(finalEnv["DSQL_API_USER_ID"] || 0),
+3 -3
View File
@@ -2,10 +2,10 @@ export default 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";
"https://www.datasquirel.com/api/media/dsql-community";
const installScriptURL = "https://datasquirel.com/api/media/install";
const updateScriptURL = "https://datasquirel.com/api/media/update";
const installScriptURL = "https://www.datasquirel.com/api/media/install";
const updateScriptURL = "https://www.datasquirel.com/api/media/update";
return {
communityTarballURL,