@opengis/fastify-table 2.0.146 → 2.0.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/suggest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/suggest.ts"],"names":[],"mappings":"AAuHA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,gBA6WzD"}
|
|
@@ -25,6 +25,14 @@ async function getTableColumnMeta({ table, template, column, selectName, filtere
|
|
|
25
25
|
.filter((el) => !el.disabled && el.sql && el.sql.includes(column) && false)
|
|
26
26
|
.map((el, i) => ` left join lateral (${el.sql}) ${el.name || `t${i}`} on 1=1 `)
|
|
27
27
|
?.join("") || "";
|
|
28
|
+
// w/out select
|
|
29
|
+
const searchQueryDefault = startsWith && key
|
|
30
|
+
? `(left(lower("text"::text),${key.length}) = $1 )`
|
|
31
|
+
: '(lower("text"::text) ~ $1 )';
|
|
32
|
+
// w/ select
|
|
33
|
+
const searchQuerySelect = startsWith && key
|
|
34
|
+
? `id in ( with cc(id, text) as (${select}) select id from cc where (left(lower("text"),${key.length})=$1) )`
|
|
35
|
+
: `id in ( with cc(id, text) as (${select}) select id from cc where (lower("text") ~ $1) )`;
|
|
28
36
|
if (pg.pgType?.[dataTypeID]?.includes("[]")) {
|
|
29
37
|
const original = filtered
|
|
30
38
|
? `with c(id,text) as (select id, id as text from (select unnest(${column}) as id from ${tableName} t ${sqlTable})q group by id) select id, text from c`
|
|
@@ -32,9 +40,7 @@ async function getTableColumnMeta({ table, template, column, selectName, filtere
|
|
|
32
40
|
return {
|
|
33
41
|
arr,
|
|
34
42
|
original,
|
|
35
|
-
searchQuery:
|
|
36
|
-
? `(left(lower("text"::text),${key.length}) = $1 )`
|
|
37
|
-
: '(lower("text"::text) ~ $1 )',
|
|
43
|
+
searchQuery: select ? searchQuerySelect : searchQueryDefault,
|
|
38
44
|
pk: "id",
|
|
39
45
|
};
|
|
40
46
|
}
|
|
@@ -44,9 +50,7 @@ async function getTableColumnMeta({ table, template, column, selectName, filtere
|
|
|
44
50
|
return {
|
|
45
51
|
arr,
|
|
46
52
|
original,
|
|
47
|
-
searchQuery:
|
|
48
|
-
? `(left(lower("text"),${key.length}) = $1 )`
|
|
49
|
-
: '(lower("text") ~ $1 )',
|
|
53
|
+
searchQuery: select ? searchQuerySelect : searchQueryDefault,
|
|
50
54
|
pk: "id",
|
|
51
55
|
};
|
|
52
56
|
}
|