This commit is contained in:
Benjamin Toby 2026-01-05 14:11:17 +01:00
parent 58984214fc
commit 9402c859f7
5 changed files with 23 additions and 5 deletions

View File

@ -256,7 +256,7 @@ function sqlGenerator({ tableName, genObject, dbFullName, count }) {
const newSubQueryObj = subQueryGroup === null || subQueryGroup === void 0 ? void 0 : subQueryGroup[_field];
return genSqlSrchStr({
queryObj: newSubQueryObj,
field: _field,
field: newSubQueryObj.fieldName || _field,
join: genObject === null || genObject === void 0 ? void 0 : genObject.join,
});
});
@ -264,7 +264,11 @@ function sqlGenerator({ tableName, genObject, dbFullName, count }) {
subSearchString.join(` ${queryObj.operator || "AND"} `) +
")");
}
return genSqlSrchStr({ queryObj, field, join: genObject === null || genObject === void 0 ? void 0 : genObject.join });
return genSqlSrchStr({
queryObj,
field: queryObj.fieldName || field,
join: genObject === null || genObject === void 0 ? void 0 : genObject.join,
});
});
const cleanedUpSearchStr = sqlSearhString === null || sqlSearhString === void 0 ? void 0 : sqlSearhString.filter((str) => typeof str == "string");
const isSearchStr = (cleanedUpSearchStr === null || cleanedUpSearchStr === void 0 ? void 0 : cleanedUpSearchStr[0]) && cleanedUpSearchStr.find((str) => str);

View File

@ -910,6 +910,11 @@ export type ServerQueryObject<T extends object = {
operator?: (typeof ServerQueryOperators)[number];
equality?: (typeof ServerQueryEqualities)[number];
tableName?: K;
/**
* This will replace the top level field name if
* provided
*/
fieldName?: string;
__query?: {
[key in keyof T]: Omit<ServerQueryObject<T>, "__query">;
};

View File

@ -349,7 +349,7 @@ export default function sqlGenerator<
return genSqlSrchStr({
queryObj: newSubQueryObj,
field: _field,
field: newSubQueryObj.fieldName || _field,
join: genObject?.join,
});
});
@ -361,7 +361,11 @@ export default function sqlGenerator<
);
}
return genSqlSrchStr({ queryObj, field, join: genObject?.join });
return genSqlSrchStr({
queryObj,
field: queryObj.fieldName || field,
join: genObject?.join,
});
});
const cleanedUpSearchStr = sqlSearhString?.filter(

View File

@ -1108,6 +1108,11 @@ export type ServerQueryObject<
operator?: (typeof ServerQueryOperators)[number];
equality?: (typeof ServerQueryEqualities)[number];
tableName?: K;
/**
* This will replace the top level field name if
* provided
*/
fieldName?: string;
__query?: {
[key in keyof T]: Omit<ServerQueryObject<T>, "__query">;
};

View File

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