@opengis/gis 0.2.185 → 0.2.186

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/gis",
3
- "version": "0.2.185",
3
+ "version": "0.2.186",
4
4
  "type": "module",
5
5
  "author": "Softpro",
6
6
  "main": "./dist/index.js",
@@ -88,11 +88,11 @@ export default async function getTableColumnMeta(
88
88
  ? `with c(id,text) as (select id, id as text from (select unnest("${queryColumn.replace(
89
89
  /"/g,
90
90
  ""
91
- )}") as id from ${tableName} t ${sqlTable})q group by id) select id, text from c`
91
+ )}"::text[]) as id from ${tableName} t ${sqlTable})q group by id) select id, text from c`
92
92
  : `with c(id,text) as (select id, id as text, count(*) from (select unnest("${queryColumn.replace(
93
93
  /"/g,
94
94
  ""
95
- )}") as id from ${tableName} t ${sqlTable})q group by id limit ${defaultLimit}) select * from c`;
95
+ )}"::text[]) as id from ${tableName} t ${sqlTable})q group by id limit ${defaultLimit}) select * from c`;
96
96
 
97
97
  return {
98
98
  arr,
@@ -103,17 +103,17 @@ export default async function getTableColumnMeta(
103
103
  }
104
104
 
105
105
  const original = filtered
106
- ? `with c(id,text) as (select rtrim( replace( replace( replace( encode("${queryColumn.replace(/"/g, '')}"::bytea, 'base64'), '+', '' ), '-', '' ), '/', '' ), '=' ) as id, "${queryColumn.replace(
106
+ ? `with c(id,text) as (select rtrim( replace( replace( replace( encode("${queryColumn.replace(/"/g, '')}"::text::bytea, 'base64'), '+', '' ), '-', '' ), '/', '' ), '=' ) as id, "${queryColumn.replace(
107
107
  /"/g,
108
108
  ""
109
- )}" as text from ${tableName} t ${sqlTable} group by "${queryColumn.replace(
109
+ )}"::text as text from ${tableName} t ${sqlTable} group by "${queryColumn.replace(
110
110
  /"/g,
111
111
  ""
112
112
  )}") select id, text from c`
113
- : `with c(id,text) as (select rtrim( replace( replace( replace( encode("${queryColumn.replace(/"/g, '')}"::bytea, 'base64'), '+', '' ), '-', '' ), '/', '' ), '=' ) as id, "${queryColumn.replace(
113
+ : `with c(id,text) as (select rtrim( replace( replace( replace( encode("${queryColumn.replace(/"/g, '')}"::text::bytea, 'base64'), '+', '' ), '-', '' ), '/', '' ), '=' ) as id, "${queryColumn.replace(
114
114
  /"/g,
115
115
  ""
116
- )}" as text, count(*) from ${tableName} t ${sqlTable} group by "${queryColumn.replace(
116
+ )}"::text as text, count(*) from ${tableName} t ${sqlTable} group by "${queryColumn.replace(
117
117
  /"/g,
118
118
  ""
119
119
  )}" limit ${defaultLimit}) select * from c`;
@@ -83,12 +83,12 @@ export default async function gisSuggest({ token, key, val, uid, lang = 'ua', li
83
83
  if (arr && !cls) {
84
84
  const sqlCls = count
85
85
  ? `select value, count(*) from (select ${pg.pgType?.[dataTypeID]?.includes("[]")
86
- ? `unnest("${name}")`
87
- : `"${name}"`
86
+ ? `unnest("${name}"::text[])`
87
+ : `"${name}"::text`
88
88
  } as value from ${table} where 1=1)q group by value`
89
89
  : `select array_agg(distinct value)::text[] from (select ${pg.pgType?.[dataTypeID]?.includes("[]")
90
- ? `unnest("${name}")`
91
- : `"${name}"`
90
+ ? `unnest("${name}"::text[])`
91
+ : `"${name}"::text`
92
92
  } as value from ${table} where 1=1)q`;
93
93
 
94
94
  if (pg?.pk?.[registry.table_name] && !cls) {
@@ -184,8 +184,8 @@ export default async function gisSuggest({ token, key, val, uid, lang = 'ua', li
184
184
  "''"
185
185
  )} o
186
186
  WHERE ${pg.pgType[dataTypeID]?.includes("[]")
187
- ? `c.text = ANY(o."${name}")`
188
- : `o."${name}" IS NOT DISTINCT FROM c.text`
187
+ ? `c.text = ANY(o."${name}"::text)`
188
+ : `o."${name}"::text IS NOT DISTINCT FROM c.text`
189
189
  } ) and ${whereQuery || "true"}
190
190
  ${order} LIMIT $${args.length}::bigint`
191
191
  : `with c(id,text) as ( ${clsMeta.original} where ${whereQuery} ${order}) select * from c LIMIT $${args.length}::bigint`;