@opengis/gis 0.2.113 → 0.2.115
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/index.css +1 -1
- package/dist/index.js +5823 -5802
- package/dist/index.umd.cjs +71 -71
- package/module/gis/table/gis.maps.table.json +0 -1
- package/module/gis/table/gis.registers.table.json +0 -1
- package/module/gis/table/gis.services.table.json +0 -1
- package/module/permissions/table/gis.permissions.table.json +0 -1
- package/package.json +1 -1
- package/server/routes/gis/registers/gis.export.js +15 -11
- package/server/routes/map/vtile1.js +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { createReadStream } from 'node:fs';
|
|
2
2
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
grpc, config, getMeta, getFolder, jsonToCsv,
|
|
6
|
+
} from '@opengis/fastify-table/utils.js';
|
|
5
7
|
|
|
6
8
|
import getInfo from './funcs/get.info.js';
|
|
7
9
|
import ContentType from './funcs/content.type.js';
|
|
@@ -13,7 +15,7 @@ const rootDir = getFolder(config, 'local');
|
|
|
13
15
|
* Експорт даних реєстру
|
|
14
16
|
* @param {Object} query - Об'єкт запиту з форматом.
|
|
15
17
|
* @param {Object} params - Об'єкт параметрів з slug та type.
|
|
16
|
-
* @param {Function} reply
|
|
18
|
+
* @param {Function} reply
|
|
17
19
|
* @returns {boolean} File
|
|
18
20
|
*/
|
|
19
21
|
|
|
@@ -33,16 +35,16 @@ export default async function gisExport({ pg, query = {}, params = {} }, reply)
|
|
|
33
35
|
registerInfo = await pg.query(
|
|
34
36
|
`SELECT table_name, columns, query
|
|
35
37
|
FROM gis.registers
|
|
36
|
-
WHERE register_key
|
|
37
|
-
[slug]
|
|
38
|
+
WHERE $1 in (register_key,register_id)`,
|
|
39
|
+
[slug],
|
|
38
40
|
);
|
|
39
41
|
}
|
|
40
42
|
if (type === 'service') {
|
|
41
43
|
serviceInfo = await pg.query(
|
|
42
44
|
`SELECT source_path as table_name, attributes as columns, query
|
|
43
45
|
FROM gis.services
|
|
44
|
-
WHERE
|
|
45
|
-
[slug]
|
|
46
|
+
WHERE $1 in (service_key,service_id)`,
|
|
47
|
+
[slug],
|
|
46
48
|
);
|
|
47
49
|
}
|
|
48
50
|
const finalInfo = registerInfo?.rows[0] || serviceInfo?.rows[0];
|
|
@@ -50,15 +52,17 @@ export default async function gisExport({ pg, query = {}, params = {} }, reply)
|
|
|
50
52
|
const exportable = finalInfo?.columns?.filter(c => c.is_export);
|
|
51
53
|
const colmodel = exportable.map(col => ({
|
|
52
54
|
name: col.name,
|
|
53
|
-
title: col.ua || col.name
|
|
55
|
+
title: col.ua || col.name,
|
|
54
56
|
}));
|
|
55
|
-
const {
|
|
57
|
+
const {
|
|
58
|
+
rows, table, srid, sqlList,
|
|
59
|
+
} = await getInfo({ finalInfo, format }, reply);
|
|
56
60
|
let filePath = ['csv', 'geojson', 'xlsx'].includes(format) ? path.join(rootDir, `/files/tmp/export_${table}_${Date.now()}.${format}`) : path.join(rootDir, `/files/tmp/export_${table}_${Date.now()}.zip`);
|
|
57
61
|
const ext = path.extname(filePath);
|
|
58
62
|
const filePathJSON = ['csv', 'geojson', 'shp'].includes(format) ? filePath.replace(ext, '.json') : filePath;
|
|
59
|
-
|
|
63
|
+
const exportedZipPaths = [];
|
|
60
64
|
|
|
61
|
-
const meta = await getMeta({ pg, table
|
|
65
|
+
const meta = await getMeta({ pg, table });
|
|
62
66
|
if ((format === 'geojson' || format === 'shp') && !meta?.geom) {
|
|
63
67
|
return reply.status(400).send('Ця таблиця не містить полів геометрії. Виберіть тип, який не потребує геометрії для вивантаження');
|
|
64
68
|
}
|
|
@@ -146,4 +150,4 @@ export default async function gisExport({ pg, query = {}, params = {} }, reply)
|
|
|
146
150
|
|
|
147
151
|
const fileStream = createReadStream(exportFilePath);
|
|
148
152
|
return reply.send(fileStream);
|
|
149
|
-
}
|
|
153
|
+
}
|
|
@@ -79,8 +79,8 @@ export default async function vtile({
|
|
|
79
79
|
const { pk: pkey = data.key, columns } = metaTable; // if view - specify via template
|
|
80
80
|
|
|
81
81
|
// props
|
|
82
|
-
|
|
83
|
-
const props = !query.all ? (data.popup || []).concat(data.card || []) : columns.filter(el => !['json', 'geometry'].includes(pg.pgType[el.dataTypeID]) && !['uid', 'cdate', 'editor_id', 'editor_date'].includes(el.name));
|
|
82
|
+
const statusColumn = style?.colorAttr || style?.iconAttr ? columns.filter(col => col.name === style.colorAttr || style?.iconAttr) : [];
|
|
83
|
+
const props = !query.all ? (statusColumn || []).concat(data.popup || []).concat(data.card || []) : columns.filter(el => !['json', 'geometry'].includes(pg.pgType[el.dataTypeID]) && !['uid', 'cdate', 'editor_id', 'editor_date'].includes(el.name));
|
|
84
84
|
|
|
85
85
|
const cache = layer + (query.all ? '-all' : '') + JSON.stringify(data.popup || []).length;
|
|
86
86
|
const propsWithCls = propsCache[cache] ?? await Promise.all(props.map(async (col, idx) => {
|