@opengis/fastify-table 2.0.46 → 2.0.51
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/dist/log/migration/dist-geoname-cls.json +1 -0
- package/dist/log/migration/dist-geoname-cls.sql +0 -0
- package/dist/server/routes/table/controllers/filter.d.ts.map +1 -1
- package/dist/server/routes/table/controllers/filter.js +5 -2
- package/dist/server/routes/table/controllers/suggest.d.ts.map +1 -1
- package/dist/server/routes/table/controllers/suggest.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"admin.user_id","module":"data","type":"select","hash":"29f728fe5e89fed0f2bec41657fae26e","dbhash":"29f728fe5e89fed0f2bec41657fae26e","update":false},{"name":"data.admin_statistic","module":"data","type":"select","hash":"8f0689a8995711c7693379a177ea4e92","dbhash":"8f0689a8995711c7693379a177ea4e92","update":false},{"name":"data.last_objects_all","module":"data","type":"select","hash":"f942c95781b420a837ae38c324cca7a9","dbhash":"f942c95781b420a837ae38c324cca7a9","update":false},{"name":"data.object_id","module":"data","type":"select","hash":"f5b4f8e86d5b3bf5da599b4e7d126ea2","dbhash":"f5b4f8e86d5b3bf5da599b4e7d126ea2","update":false},{"name":"data.site_statistic","module":"data","type":"select","hash":"fbc3b42fee3ef287b3a576bb1a0b43b4","dbhash":"fbc3b42fee3ef287b3a576bb1a0b43b4","update":false},{"name":"data_addition.change_status.parent","module":"data_addition","type":"select","hash":"517f0390a98a5642b94a62dbbd058441","dbhash":"517f0390a98a5642b94a62dbbd058441","update":false},{"name":"data_addition.deregistration.parent","module":"data_addition","type":"select","hash":"1dbbd6e0a48e52a9c23dedad368f06c3","dbhash":"1dbbd6e0a48e52a9c23dedad368f06c3","update":false},{"name":"data_addition.historical_name.parent","module":"data_addition","type":"select","hash":"3d42dee53b639fb594e9961492f577cc","dbhash":"3d42dee53b639fb594e9961492f577cc","update":false},{"name":"data_addition.national_lang_name.parent","module":"data_addition","type":"select","hash":"c3a9ac90dd38c02736503d003a0ca012","dbhash":"c3a9ac90dd38c02736503d003a0ca012","update":false},{"name":"data_addition.objects_atu.parent","module":"data_addition","type":"select","hash":"1629be10ba3bd71280621dc7e6737092","dbhash":"1629be10ba3bd71280621dc7e6737092","update":false},{"name":"data_addition.objects_countries.parent","module":"data_addition","type":"select","hash":"b389f543053bf35a5469580333cc1b0b","dbhash":"b389f543053bf35a5469580333cc1b0b","update":false},{"name":"data_addition.options_name.parent","module":"data_addition","type":"select","hash":"e5d02b5f8d64a18cf21b1daa448fe54e","dbhash":"e5d02b5f8d64a18cf21b1daa448fe54e","update":false},{"name":"data_addition.options_type.parent","module":"data_addition","type":"select","hash":"fb41e8f7b9cf18786611d8e880ff4051","dbhash":"fb41e8f7b9cf18786611d8e880ff4051","update":false},{"name":"data_addition.rename.parent","module":"data_addition","type":"select","hash":"c883a3baf1beb4a7d3d5bdb28062be69","dbhash":"c883a3baf1beb4a7d3d5bdb28062be69","update":false},{"name":"data_countries.object_id","module":"data_countries","type":"select","hash":"a6f120bea7bd0df1afcdb1b56484e516","dbhash":"a6f120bea7bd0df1afcdb1b56484e516","update":false},{"name":"dict.admin_status","module":"dict","type":"select","hash":"10452051e966f3051456226b78d1e11b","dbhash":"10452051e966f3051456226b78d1e11b","update":false},{"name":"dict.atu_countries","module":"dict","type":"select","hash":"c7368a1b9c10350e5709872d933a6ffb","dbhash":"c7368a1b9c10350e5709872d933a6ffb","update":false},{"name":"dict.atu_type","module":"dict","type":"select","hash":"376a4e7a7e77d5f9ee865b8a1fb25e07","dbhash":"376a4e7a7e77d5f9ee865b8a1fb25e07","update":false},{"name":"dict.community","module":"dict","type":"select","hash":"deb128826eb03dbca6762f058f49e980","dbhash":"deb128826eb03dbca6762f058f49e980","update":false},{"name":"dict.country_location","module":"dict","type":"select","hash":"333f3f56fc1a9f79f176f509d8aeca53","dbhash":"333f3f56fc1a9f79f176f509d8aeca53","update":false},{"name":"dict.district","module":"dict","type":"select","hash":"0d3a18d3fe4e6329567f5ba5cc360d53","dbhash":"0d3a18d3fe4e6329567f5ba5cc360d53","update":false},{"name":"dict.existence","module":"dict","type":"select","hash":"781bb2394e4f5eee87cbaf6ff1cc358e","dbhash":"781bb2394e4f5eee87cbaf6ff1cc358e","update":false},{"name":"dict.foreign_country","module":"dict","type":"select","hash":"dd4d5c31a9eea9abd538acdb952e99e9","dbhash":"dd4d5c31a9eea9abd538acdb952e99e9","update":false},{"name":"dict.info_source","module":"dict","type":"select","hash":"0ae17d8e43740078dea206cc7949151f","dbhash":"0ae17d8e43740078dea206cc7949151f","update":false},{"name":"dict.language","module":"dict","type":"select","hash":"fd1826c9ca150ef93bd251b923d6094e","dbhash":"fd1826c9ca150ef93bd251b923d6094e","update":false},{"name":"dict.object_type.adm","module":"dict","type":"select","hash":"0faeff4dc1c1f60996efe614d44a6e5f","dbhash":"0faeff4dc1c1f60996efe614d44a6e5f","update":false},{"name":"dict.object_type.geo","module":"dict","type":"select","hash":"34b82095969396e8a8497f93cda3dcc5","dbhash":"34b82095969396e8a8497f93cda3dcc5","update":false},{"name":"dict.object_type.pzf","module":"dict","type":"select","hash":"df2c1ced6405602aa8f262e437ac5062","dbhash":"df2c1ced6405602aa8f262e437ac5062","update":false},{"name":"dict.object_type.soc","module":"dict","type":"select","hash":"d60d3f993acb76e5782e4a3046756858","dbhash":"d60d3f993acb76e5782e4a3046756858","update":false},{"name":"dict.object_type","module":"dict","type":"select","hash":"9630e32f344f33580d5a90e305bf5cf2","dbhash":"9630e32f344f33580d5a90e305bf5cf2","update":false},{"name":"dict.region","module":"dict","type":"select","hash":"c1e0b38f520a004726694109398d5544","dbhash":"c1e0b38f520a004726694109398d5544","update":false},{"name":"dict.settlement_type","module":"dict","type":"select","hash":"49261c87bf6cd01e4ab32f65c94b5dbf","dbhash":"49261c87bf6cd01e4ab32f65c94b5dbf","update":false},{"name":"dict.source","module":"dict","type":"select","hash":"ac2bf8aca5c819e42b6529c73a7e1cb5","dbhash":"ac2bf8aca5c819e42b6529c73a7e1cb5","update":false},{"name":"dict.source_name","module":"dict","type":"select","hash":"9550cb3ad87783d7528c3c440be50a89","dbhash":"9550cb3ad87783d7528c3c440be50a89","update":false},{"name":"dict.source_type","module":"dict","type":"select","hash":"fee4eb12cd50344d2de7c49290238501","dbhash":"fee4eb12cd50344d2de7c49290238501","update":false},{"name":"core.accounts","module":"settings","type":"select","hash":"36eef3856f46bc0eecb61a6f911ced2e","dbhash":"36eef3856f46bc0eecb61a6f911ced2e","update":false},{"name":"core.menu_id","module":"settings","type":"select","hash":"3b08d360628afa15339f364f5e2ff211","dbhash":"3b08d360628afa15339f364f5e2ff211","update":false},{"name":"core.roles","module":"settings","type":"select","hash":"ed1290380ea5e5e7e48bd08b41cb7793","dbhash":"ed1290380ea5e5e7e48bd08b41cb7793","update":false},{"name":"core.routes.alias","module":"settings","type":"select","hash":"ac6afe9a8ebaf0b26236c4bae5297709","dbhash":"ac6afe9a8ebaf0b26236c4bae5297709","update":false},{"name":"core.routes","module":"settings","type":"select","hash":"306bddbe5b73b0628728a60f5335aaee","dbhash":"306bddbe5b73b0628728a60f5335aaee","update":false},{"name":"core.rules","module":"settings","type":"select","hash":"a86085f579f4abff5cf09e775e034ed3","dbhash":"a86085f579f4abff5cf09e775e034ed3","update":false},{"name":"core.user_mentioned","module":"settings","type":"select","hash":"6687f073de73a3ec4b6e0811d9310e7e","dbhash":"6687f073de73a3ec4b6e0811d9310e7e","update":false},{"name":"core.user_uid","module":"settings","type":"select","hash":"45f7d8a57ecbca5b433be7937be51d5c","dbhash":"45f7d8a57ecbca5b433be7937be51d5c","update":false},{"name":"data.exist_flag","module":"data","type":"cls","hash":"4cc57ff8d055dd194b51a6937d70f04c","dbhash":"4cc57ff8d055dd194b51a6937d70f04c","update":false},{"name":"data.latitude_dir","module":"data","type":"cls","hash":"542cd461818ff655002fec7bf23dcdb1","dbhash":"542cd461818ff655002fec7bf23dcdb1","update":false},{"name":"data.longitude_dir","module":"data","type":"cls","hash":"39f5c0554eab4f34ae25312d8dfafa78","dbhash":"39f5c0554eab4f34ae25312d8dfafa78","update":false},{"name":"data._type","module":"data","type":"cls","hash":"588c9b704054165dc6977f1262bbfee7","dbhash":"588c9b704054165dc6977f1262bbfee7","update":false},{"name":"access_type","module":"settings","type":"cls","hash":"e02065dbaed2ccb437a1722c00ed3fab","dbhash":"e02065dbaed2ccb437a1722c00ed3fab","update":false},{"name":"change_type","module":"settings","type":"cls","hash":"0fcaac1864fc81b9760075836c1bb2ac","dbhash":"0fcaac1864fc81b9760075836c1bb2ac","update":false},{"name":"core.actions","module":"settings","type":"cls","hash":"17862ea92ef5ad846a284fd68b4ff1f7","dbhash":"17862ea92ef5ad846a284fd68b4ff1f7","update":false},{"name":"core.column_type","module":"settings","type":"cls","hash":"8004d1fc1876e6f5a096b4f40a7f3775","dbhash":"8004d1fc1876e6f5a096b4f40a7f3775","update":false},{"name":"core.scope","module":"settings","type":"cls","hash":"c274693f6c7e9849704bbf4c46334871","dbhash":"c274693f6c7e9849704bbf4c46334871","update":false},{"name":"properties.site_status","module":"settings","type":"cls","hash":"2c2980706c5afe8808000d971b304cc9","dbhash":"2c2980706c5afe8808000d971b304cc9","update":false},{"name":"properties.widget_status","module":"settings","type":"cls","hash":"232f321af15895a9b33953c9bd500043","dbhash":"232f321af15895a9b33953c9bd500043","update":false},{"name":"users.user_type","module":"settings","type":"cls","hash":"9f6a303d48d2d33c68dbcd8e72ad0e83","dbhash":"9f6a303d48d2d33c68dbcd8e72ad0e83","update":false},{"name":"yes_no","module":"settings","type":"cls","hash":"50c527053426248c20b0a2f112ff9046","dbhash":"50c527053426248c20b0a2f112ff9046","update":false}]
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/filter.ts"],"names":[],"mappings":"AAWA,UAAU,OAAO;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;CAC3B;AAED,wBAA8B,SAAS,CACrC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,GAAG,GACZ,OAAO,CAAC,OAAO,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,GAAG,CAAC,CA6RvE"}
|
|
@@ -6,6 +6,7 @@ import getSelectVal from "../../../plugins/table/funcs/metaFormat/getSelectVal.j
|
|
|
6
6
|
import pgClients from "../../../plugins/pg/pgClients.js";
|
|
7
7
|
import { applyHook } from "../../../../utils.js";
|
|
8
8
|
import getTemplate from "../../../plugins/table/funcs/getTemplate.js";
|
|
9
|
+
import getMeta from "../../../plugins/pg/funcs/getMeta.js";
|
|
9
10
|
export default async function filterAPI(req, reply, iscalled) {
|
|
10
11
|
const time = Date.now();
|
|
11
12
|
const { params, pg = pgClients.client, user = {}, query = {} } = req;
|
|
@@ -14,11 +15,13 @@ export default async function filterAPI(req, reply, iscalled) {
|
|
|
14
15
|
table: params.table,
|
|
15
16
|
}));
|
|
16
17
|
const loadTable = await getTemplate("table", params.table);
|
|
17
|
-
const { table, sql, query: tableQuery, form, extra, filterState, filterCustom, } = hookData || loadTable || {};
|
|
18
|
+
const { key, table, sql, query: tableQuery, form, extra, filterState, filterCustom, } = hookData || loadTable || {};
|
|
18
19
|
if (!table) {
|
|
19
20
|
return { status: 404, message: "not found" };
|
|
20
21
|
}
|
|
21
|
-
const pk =
|
|
22
|
+
const { pk: pk1, view } = await getMeta({ pg, table });
|
|
23
|
+
// const pk = pg.pk?.[table] || pg.pk?.[table.replace(/"/g, "")];
|
|
24
|
+
const pk = !pk1 && view ? key : pk1;
|
|
22
25
|
if (!pk) {
|
|
23
26
|
return { status: 404, message: "table not found" };
|
|
24
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/suggest.ts"],"names":[],"mappings":"AAsDA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/suggest.ts"],"names":[],"mappings":"AAsDA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,gBAgV7C"}
|
|
@@ -199,7 +199,7 @@ export default async function suggest(req) {
|
|
|
199
199
|
? `unnest(${filterColumn})`
|
|
200
200
|
: filterColumn} from ${(loadTable?.table || query.token).replace(/'/g, "''")})`
|
|
201
201
|
: "true";
|
|
202
|
-
const sqlSuggest = `with c(id,text) as ( ${meta.original.replace(/{{parent}}/gi, parent)} where ${where} order by 2) select * from c where ${filter} limit ${Math.min(query.limit || meta.limit || limit, limit)}`.replace(/{{uid}}/g, user?.uid || "0");
|
|
202
|
+
const sqlSuggest = `with c(id,text) as ( ${meta.original.replace(/{{parent}}/gi, parent)} where ${where} ${meta.original.includes("order by") ? "" : "order by 2"}) select * from c where ${filter} limit ${Math.min(query.limit || meta.limit || limit, limit)}`.replace(/{{uid}}/g, user?.uid || "0");
|
|
203
203
|
if (query.sql && (config.local || user?.user_type?.includes?.("admin"))) {
|
|
204
204
|
return sqlSuggest;
|
|
205
205
|
}
|