@saltcorn/db-common
Advanced tools
Comparing version 0.7.2-beta.0 to 0.7.2-beta.2
@@ -10,2 +10,3 @@ /** | ||
export * from "./internal"; | ||
export * from "./sqlite-commons"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -39,2 +39,3 @@ "use strict"; | ||
__exportStar(require("./internal"), exports); | ||
__exportStar(require("./sqlite-commons"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -34,2 +34,3 @@ /** | ||
searchTerm: string; | ||
schema?: string; | ||
}; | ||
@@ -36,0 +37,0 @@ or?: Where[]; |
@@ -83,4 +83,4 @@ "use strict"; | ||
const whereFTS = (v, phs) => { | ||
const { fields, table } = v; | ||
let flds = fields | ||
const { fields, table, schema } = v; | ||
let fldsArray = fields | ||
.filter((f) => f.type && f.type.sql_name === "text") | ||
@@ -91,4 +91,9 @@ .map((f) => "coalesce(" + | ||
: `"${(0, exports.sqlsanitize)(f.name)}"`) + | ||
",'')") | ||
.join(" || ' ' || "); | ||
",'')"); | ||
fields | ||
.filter((f) => f.is_fkey && f?.attributes?.include_fts) | ||
.forEach((f) => { | ||
fldsArray.push(`coalesce((select ${f.attributes.summary_field} from ${schema ? `"${schema}".` : ""}"${f.reftable_name}" rt where rt.id=${table ? `"${(0, exports.sqlsanitize)(table)}".` : ""}"${f.name}"),'')`); | ||
}); | ||
let flds = fldsArray.join(" || ' ' || "); | ||
const prefixMatch = !v.searchTerm?.includes(" "); | ||
@@ -95,0 +100,0 @@ const searchTerm = prefixMatch ? `${v.searchTerm}:*` : v.searchTerm; |
{ | ||
"name": "@saltcorn/db-common", | ||
"version": "0.7.2-beta.0", | ||
"version": "0.7.2-beta.2", | ||
"description": "Db common structures for Saltcorn, open-source no-code platform", | ||
@@ -29,3 +29,3 @@ "homepage": "https://saltcorn.com", | ||
"devDependencies": { | ||
"jest": "26.6.3", | ||
"jest": "^27.1.0", | ||
"@types/node": "^16.11.9", | ||
@@ -32,0 +32,0 @@ "typescript": "^4.4.4" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108161
30
1080