@opengis/gis 0.2.113 → 0.2.114
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/module/test/cls/doc_status.json +31 -31
- package/module/test/select/core.user_uid.sql +1 -1
- package/package.json +2 -2
- package/server/routes/gis/registers/gis.export.js +15 -11
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": "1",
|
|
4
|
-
"text": "Діючий",
|
|
5
|
-
"color": "#1ab394"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"id": "2",
|
|
9
|
-
"text": "Зупинений",
|
|
10
|
-
"color": "#ed82c8"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"id": "3",
|
|
14
|
-
"text": "Скасований",
|
|
15
|
-
"color": "#4a4a4a"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"id": "5",
|
|
19
|
-
"text": "Проектний",
|
|
20
|
-
"color": "#6495ed"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"id": "7",
|
|
24
|
-
"text": "Очікує розгляду",
|
|
25
|
-
"color": "#92b8ef"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"id": "10",
|
|
29
|
-
"text": "Архівний",
|
|
30
|
-
"color": "#d48428"
|
|
31
|
-
}
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "1",
|
|
4
|
+
"text": "Діючий",
|
|
5
|
+
"color": "#1ab394"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"id": "2",
|
|
9
|
+
"text": "Зупинений",
|
|
10
|
+
"color": "#ed82c8"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "3",
|
|
14
|
+
"text": "Скасований",
|
|
15
|
+
"color": "#4a4a4a"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "5",
|
|
19
|
+
"text": "Проектний",
|
|
20
|
+
"color": "#6495ed"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "7",
|
|
24
|
+
"text": "Очікує розгляду",
|
|
25
|
+
"color": "#92b8ef"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "10",
|
|
29
|
+
"text": "Архівний",
|
|
30
|
+
"color": "#d48428"
|
|
31
|
+
}
|
|
32
32
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
select uid, coalesce(coalesce(sur_name,'')||coalesce(' '||user_name,'') ||coalesce(' '||father_name,''),login) as text from admin.users
|
|
1
|
+
select uid, coalesce(coalesce(sur_name,'')||coalesce(' '||user_name,'') ||coalesce(' '||father_name,''),login) as text from admin.users
|
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
|
+
}
|