@opengis/fastify-table 2.6.2 → 2.6.3
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/README.md +86 -86
- package/dist/functions.js +20 -20
- package/dist/module/core/cls/constraint_action.json +9 -9
- package/dist/module/core/cls/constraint_matchtype.json +5 -5
- package/dist/module/core/cls/constraint_type_full.json +17 -17
- package/dist/module/core/cls/core.user_type.json +13 -13
- package/dist/module/core/pt/schemaItem.pt.hbs +17 -17
- package/dist/module/core/select/core.user_mentioned.sql +1 -1
- package/dist/script/adduser +14 -14
- package/dist/script/dump.js +48 -48
- package/dist/script/dump.ts +216 -216
- package/dist/script/migrate.ts +23 -23
- package/dist/server/helpers/core/badge.js +1 -1
- package/dist/server/helpers/list/descriptionList.js +8 -8
- package/dist/server/helpers/list/tableList.js +4 -4
- package/dist/server/helpers/list/utils/button.js +1 -1
- package/dist/server/helpers/list/utils/buttonDel.js +3 -3
- package/dist/server/helpers/list/utils/buttonEdit.js +3 -3
- package/dist/server/helpers/utils/button.js +1 -1
- package/dist/server/helpers/utils/buttonAdd.js +15 -15
- package/dist/server/helpers/utils/buttonDel.js +11 -11
- package/dist/server/helpers/utils/buttonEdit.js +3 -3
- package/dist/server/migrations/0.sql +99 -99
- package/dist/server/migrations/1_users.sql +145 -145
- package/dist/server/migrations/cls.sql +105 -105
- package/dist/server/migrations/context.sql +136 -136
- package/dist/server/migrations/dictionaries.sql +78 -78
- package/dist/server/migrations/oauth.sql +79 -79
- package/dist/server/migrations/properties.sql +115 -115
- package/dist/server/migrations/roles.sql +201 -201
- package/dist/server/migrations/template.sql +43 -43
- package/dist/server/plugins/access/funcs/getUserPermissions.js +7 -7
- package/dist/server/plugins/auth/funcs/authorizeUser.js +4 -4
- package/dist/server/plugins/auth/funcs/getQuery.js +20 -20
- package/dist/server/plugins/auth/index.js +3 -3
- package/dist/server/plugins/crud/funcs/dataUpdate.js +7 -7
- package/dist/server/plugins/crud/funcs/getAccess.js +14 -14
- package/dist/server/plugins/crud/funcs/utils/getInsertQuery.js +6 -6
- package/dist/server/plugins/crud/funcs/utils/logChanges.js +18 -18
- package/dist/server/plugins/grpc/utils/convertp.proto +143 -143
- package/dist/server/plugins/grpc/utils/htmlTemplate.js +10 -10
- package/dist/server/plugins/grpc/utils/office2pdf.proto +13 -13
- package/dist/server/plugins/metric/loggerSystem.js +1 -1
- package/dist/server/plugins/pg/funcs/autoIndex.js +5 -5
- package/dist/server/plugins/pg/funcs/getMeta.js +15 -15
- package/dist/server/plugins/pg/funcs/init.js +36 -36
- package/dist/server/plugins/sqlite/funcs/init.js +22 -22
- package/dist/server/plugins/table/funcs/getData.js +13 -13
- package/dist/server/plugins/table/funcs/getFilterSQL/util/getCustomQuery.js +1 -1
- package/dist/server/plugins/table/funcs/getSelect.js +1 -1
- package/dist/server/plugins/table/funcs/gisIRColumn.js +3 -3
- package/dist/server/plugins/usercls/index.js +2 -2
- package/dist/server/routes/access/controllers/access.group.js +6 -6
- package/dist/server/routes/access/controllers/access.group.post.js +3 -3
- package/dist/server/routes/access/controllers/access.interface.js +14 -14
- package/dist/server/routes/access/controllers/access.user.js +6 -6
- package/dist/server/routes/auth/controllers/2factor/providers/totp.js +5 -5
- package/dist/server/routes/auth/controllers/2factor/qrcode.js +1 -1
- package/dist/server/routes/auth/controllers/2factor/recovery.js +1 -1
- package/dist/server/routes/auth/controllers/2factor/verify.js +1 -1
- package/dist/server/routes/auth/controllers/core/getUserInfo.js +33 -33
- package/dist/server/routes/auth/controllers/core/passwordRecovery.js +1 -1
- package/dist/server/routes/auth/controllers/core/registration.js +2 -2
- package/dist/server/routes/auth/controllers/page/login2faTemplate.js +1 -1
- package/dist/server/routes/crud/functions/deleteTableRelation.js +9 -9
- package/dist/server/routes/crud/functions/updateTableRelation.js +9 -9
- package/dist/server/routes/file/controllers/resizeAll.js +7 -7
- package/dist/server/routes/grpc/controllers/file2geojson.js +13 -13
- package/dist/server/routes/menu/controllers/getMenu.js +9 -9
- package/dist/server/routes/notifications/controllers/readNotifications.js +4 -4
- package/dist/server/routes/notifications/controllers/userNotifications.js +3 -3
- package/dist/server/routes/table/controllers/card.js +1 -1
- package/dist/server/routes/table/controllers/filter.js +6 -6
- package/dist/server/routes/table/controllers/form.js +1 -1
- package/dist/server/routes/table/controllers/getFormByTable.js +6 -6
- package/dist/server/routes/table/controllers/suggest.d.ts.map +1 -1
- package/dist/server/routes/table/controllers/suggest.js +33 -22
- package/dist/server/routes/table/controllers/tableData.js +2 -2
- package/dist/server/routes/table/controllers/tableInfo.js +10 -10
- package/dist/server/routes/table/functions/getData.js +13 -13
- package/dist/server/routes/table/schema.d.ts +5 -0
- package/dist/server/routes/table/schema.d.ts.map +1 -1
- package/dist/server/routes/table/schema.js +1 -0
- package/dist/server/routes/widget/controllers/widget.get.js +33 -33
- package/dist/server/routes/widget/controllers/widget.set.js +4 -4
- package/dist/server/routes/widget/services/widget.entity.get.js +33 -33
- package/dist/server/routes/widget/services/widget.entity.set.js +4 -4
- package/dist/server/templates/page/2factor-recovery.html +101 -101
- package/dist/server/templates/page/2factor.html +140 -140
- package/dist/server/templates/page/login.html +90 -90
- package/dist/server/templates/pt/recovery-codes-email-template.hbs +12 -12
- package/dist/server/templates/pt/recovery-password-email-template.html +20 -20
- package/package.json +99 -99
|
@@ -73,19 +73,19 @@ export default async function dataUpdate({ table: table1, tokenData, referer, id
|
|
|
73
73
|
// update geometry with srid
|
|
74
74
|
if (!srids[table] && pg.tlist?.includes("public.geometry_columns")) {
|
|
75
75
|
const { srids1 } = await pg
|
|
76
|
-
.query(`select json_object_agg(_table,rel) as srids1 from (
|
|
77
|
-
select f_table_schema||'.'||f_table_name as _table,
|
|
78
|
-
json_object_agg(f_geometry_column, case when srid = 0 then 4326 else srid end) as rel
|
|
79
|
-
from public.geometry_columns group by f_table_schema||'.'||f_table_name
|
|
76
|
+
.query(`select json_object_agg(_table,rel) as srids1 from (
|
|
77
|
+
select f_table_schema||'.'||f_table_name as _table,
|
|
78
|
+
json_object_agg(f_geometry_column, case when srid = 0 then 4326 else srid end) as rel
|
|
79
|
+
from public.geometry_columns group by f_table_schema||'.'||f_table_name
|
|
80
80
|
)q`)
|
|
81
81
|
.then((el) => el.rows?.[0] || {});
|
|
82
82
|
Object.assign(srids, srids1);
|
|
83
83
|
}
|
|
84
|
-
const updateQuery = `UPDATE ${table} SET ${systemColumns ? `${systemColumns}${filterData?.length ? "," : ""}` : ""}
|
|
85
|
-
|
|
84
|
+
const updateQuery = `UPDATE ${table} SET ${systemColumns ? `${systemColumns}${filterData?.length ? "," : ""}` : ""}
|
|
85
|
+
|
|
86
86
|
${filterData
|
|
87
87
|
?.map((key, i) => assignValue(key, i, srids[table]?.[key] || 4326, pg.pgType?.[columns.find((col) => col.name === key)?.dataTypeID || ""]))
|
|
88
|
-
?.join(",")}
|
|
88
|
+
?.join(",")}
|
|
89
89
|
WHERE ${pk}::text = $1::text returning *`;
|
|
90
90
|
// console.log(updateQuery, filterValue);
|
|
91
91
|
// for transactions
|
|
@@ -10,20 +10,20 @@ const matches = {
|
|
|
10
10
|
update: "edit",
|
|
11
11
|
delete: "del",
|
|
12
12
|
};
|
|
13
|
-
const q = `select a.route_id as id, d.actions as user_roles, d.actions as role_actions, coalesce(b.actions, array['view']) as interface_actions, b.scope, c.role_id
|
|
14
|
-
from admin.routes a
|
|
15
|
-
left join admin.role_access b on
|
|
16
|
-
a.route_id=b.route_id
|
|
17
|
-
left join admin.roles c on
|
|
18
|
-
b.role_id=c.role_id
|
|
19
|
-
and c.enabled
|
|
20
|
-
left join admin.user_roles d on
|
|
21
|
-
c.role_id=d.role_id
|
|
22
|
-
and ( case when
|
|
23
|
-
d.expiration is not null
|
|
24
|
-
then d.expiration > CURRENT_DATE
|
|
25
|
-
else 1=1
|
|
26
|
-
end )
|
|
13
|
+
const q = `select a.route_id as id, d.actions as user_roles, d.actions as role_actions, coalesce(b.actions, array['view']) as interface_actions, b.scope, c.role_id
|
|
14
|
+
from admin.routes a
|
|
15
|
+
left join admin.role_access b on
|
|
16
|
+
a.route_id=b.route_id
|
|
17
|
+
left join admin.roles c on
|
|
18
|
+
b.role_id=c.role_id
|
|
19
|
+
and c.enabled
|
|
20
|
+
left join admin.user_roles d on
|
|
21
|
+
c.role_id=d.role_id
|
|
22
|
+
and ( case when
|
|
23
|
+
d.expiration is not null
|
|
24
|
+
then d.expiration > CURRENT_DATE
|
|
25
|
+
else 1=1
|
|
26
|
+
end )
|
|
27
27
|
where $1 in (a.route_id, a.alias, a.table_name) and $2 in (b.user_uid, d.user_uid)`;
|
|
28
28
|
/**
|
|
29
29
|
* @param {Array} user_roles.actions Actions - user actions <> group actions
|
|
@@ -34,20 +34,20 @@ export default async function getInsertQuery({ pg, table, data, id, uid, }) {
|
|
|
34
34
|
(["boolean", "number"].includes(typeof data[el]) ? true : data[el]) &&
|
|
35
35
|
names.includes(el))
|
|
36
36
|
.map((el) => [el, data[el]]);
|
|
37
|
-
const insertQuery = `insert into ${table}
|
|
38
|
-
|
|
37
|
+
const insertQuery = `insert into ${table}
|
|
38
|
+
|
|
39
39
|
( ${filterData
|
|
40
40
|
?.map((key) => `"${key[0]}"`)
|
|
41
41
|
.concat(systemColumnNames)
|
|
42
|
-
.join(",")})
|
|
43
|
-
|
|
42
|
+
.join(",")})
|
|
43
|
+
|
|
44
44
|
values (${filterData
|
|
45
45
|
?.map((key, i) => key[0] === "geom"
|
|
46
46
|
? `st_setsrid(st_geomfromgeojson($${i + 1}::json),4326)`
|
|
47
47
|
: `$${i + 1}`)
|
|
48
48
|
.concat(systemColumns.map((el) => el[1]))
|
|
49
|
-
.join(",")})
|
|
50
|
-
|
|
49
|
+
.join(",")})
|
|
50
|
+
|
|
51
51
|
returning *`;
|
|
52
52
|
const args = [
|
|
53
53
|
...filterData.map((el) => typeof el[1] === "object" &&
|
|
@@ -71,25 +71,25 @@ export default async function logChanges({ pg, table: table1, tokenData, referer
|
|
|
71
71
|
}
|
|
72
72
|
try {
|
|
73
73
|
const { change_id: changeId } = await pg
|
|
74
|
-
.query(`insert into log.table_changes(change_date,change_type,change_user_id,entity_type,entity_id)
|
|
74
|
+
.query(`insert into log.table_changes(change_date,change_type,change_user_id,entity_type,entity_id)
|
|
75
75
|
values(CURRENT_DATE, $1, $2, $3, $4) returning change_id`, [type, uid, table, id])
|
|
76
76
|
.then((el) => el.rows?.[0] || {});
|
|
77
|
-
const q = `select json_object_agg(entity_key, json_build_object('hash',value_hash,'value',value_new)) from (
|
|
78
|
-
select
|
|
79
|
-
entity_key,
|
|
80
|
-
value_hash,
|
|
81
|
-
value_new,
|
|
82
|
-
( rank() over (partition by entity_key order by cdate desc) = 1 ) as is_latest
|
|
83
|
-
from log.table_changes_data
|
|
84
|
-
|
|
85
|
-
where change_id in (
|
|
86
|
-
select
|
|
87
|
-
change_id
|
|
88
|
-
from log.table_changes
|
|
89
|
-
where entity_id=$1
|
|
90
|
-
and entity_type=$2
|
|
91
|
-
)
|
|
92
|
-
|
|
77
|
+
const q = `select json_object_agg(entity_key, json_build_object('hash',value_hash,'value',value_new)) from (
|
|
78
|
+
select
|
|
79
|
+
entity_key,
|
|
80
|
+
value_hash,
|
|
81
|
+
value_new,
|
|
82
|
+
( rank() over (partition by entity_key order by cdate desc) = 1 ) as is_latest
|
|
83
|
+
from log.table_changes_data
|
|
84
|
+
|
|
85
|
+
where change_id in (
|
|
86
|
+
select
|
|
87
|
+
change_id
|
|
88
|
+
from log.table_changes
|
|
89
|
+
where entity_id=$1
|
|
90
|
+
and entity_type=$2
|
|
91
|
+
)
|
|
92
|
+
|
|
93
93
|
)q where is_latest`;
|
|
94
94
|
// console.log(q, type, id);
|
|
95
95
|
const old = type !== "INSERT"
|
|
@@ -168,7 +168,7 @@ export default async function logChanges({ pg, table: table1, tokenData, referer
|
|
|
168
168
|
const res = await sequence(changesData, async (el) => {
|
|
169
169
|
const insertQuery = `insert into log.table_changes_data (${Object.entries(el)
|
|
170
170
|
?.map((key) => `"${key[0]}"`)
|
|
171
|
-
.join(",")})
|
|
171
|
+
.join(",")})
|
|
172
172
|
values (${Object.entries(el)
|
|
173
173
|
?.map((key, i) => `$${i + 1}`)
|
|
174
174
|
.join(",")}) returning *`;
|
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
service Convert {
|
|
4
|
-
rpc HealthCheck (Empty) returns (HealthResponse);
|
|
5
|
-
rpc csvToXls(csvToXlsParams) returns (FileBase64) {}
|
|
6
|
-
rpc jsonToXls(jsonToXlsParams) returns (FileBase64) {}
|
|
7
|
-
rpc pdfMerge(pdfMergeParams) returns (FileBase64) {}
|
|
8
|
-
rpc htmlToPdf(htmlToPdfParams) returns (FileBase64) {}
|
|
9
|
-
rpc excelToJson(excelToJsonParams) returns (FileBase64) {}
|
|
10
|
-
rpc xmlToJson(xmlToJsonParams) returns (FileBase64) {}
|
|
11
|
-
rpc htmlToDoc(htmlToDocParams) returns (FileBase64) {}
|
|
12
|
-
rpc htmlToImage(htmlToImageParams) returns (FileBase64) {}
|
|
13
|
-
rpc geojsonToShp(geojsonToShpParams) returns (FileBase64) {}
|
|
14
|
-
rpc shpToGeojson(shpToGeojsonParams) returns (FileBase64) {}
|
|
15
|
-
rpc docToPDF(docToPDFParams) returns (FileBase64) {}
|
|
16
|
-
rpc mergeImages(mergeImagesIn) returns (FileBase64) {}
|
|
17
|
-
rpc resizeImage(resizeImageIn) returns (FileBase64) {}
|
|
18
|
-
rpc jsonToYaml(jsonToYamlIn) returns (FileBase64) {}
|
|
19
|
-
rpc yamlToJson(yamlToJsonIn) returns (FileBase64) {}
|
|
20
|
-
rpc log(log_in) returns (log_out) {}
|
|
21
|
-
rpc geojsonToGpkg(geojsonToShpParams) returns (FileBase64) {}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
message Empty {}
|
|
25
|
-
|
|
26
|
-
message HealthResponse {
|
|
27
|
-
string status = 1;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
message jsonToYamlIn {
|
|
31
|
-
string json = 1;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
message yamlToJsonIn {
|
|
35
|
-
string yaml = 1;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
message resizeImageIn {
|
|
39
|
-
string base64 = 1;
|
|
40
|
-
uint64 width = 2;
|
|
41
|
-
uint64 height = 3;
|
|
42
|
-
uint32 quality = 4;
|
|
43
|
-
uint32 subsampling = 5;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
message pdfToImgIn {
|
|
47
|
-
string pdfPath = 1;
|
|
48
|
-
string imgPath = 2;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
message pdfToImgOut {
|
|
52
|
-
string imgPath = 1;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
message log_in {
|
|
56
|
-
uint32 rows = 1;
|
|
57
|
-
string level = 2;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
message log_out {
|
|
61
|
-
repeated string logs = 1;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
enum mergeImageFormat {
|
|
65
|
-
VERTICAL = 0;
|
|
66
|
-
HORIZONTAL = 1;
|
|
67
|
-
OVERLAY = 2;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
message imageMeta {
|
|
71
|
-
string base64 = 1;
|
|
72
|
-
mergeImageFormat mergeFormat = 2;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
message mergeImagesIn {
|
|
76
|
-
repeated string images = 1;
|
|
77
|
-
repeated imageMeta imagesMeta = 2;
|
|
78
|
-
string background = 3;
|
|
79
|
-
string mergeFormat = 4;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
message docToPDFParams {
|
|
83
|
-
string base64 = 1;
|
|
84
|
-
string to = 2;
|
|
85
|
-
string ext = 3;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
message shpToGeojsonParams {
|
|
89
|
-
string base64 = 1;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
message geojsonToShpParams {
|
|
93
|
-
string geojson = 1;
|
|
94
|
-
string proj = 2;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
message xmlToJsonParams {
|
|
98
|
-
string xml = 1;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
message jsonToXlsParams {
|
|
102
|
-
string json = 1;
|
|
103
|
-
string header = 2;
|
|
104
|
-
string subheader = 3;
|
|
105
|
-
string colmodel = 4;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
message csvToXlsParams {
|
|
109
|
-
string csv = 1;
|
|
110
|
-
string header = 2;
|
|
111
|
-
string subheader = 3;
|
|
112
|
-
string separator = 4;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
message excelToJsonParams {
|
|
116
|
-
string base64 = 1;
|
|
117
|
-
string type = 2;
|
|
118
|
-
string delimiter = 3;
|
|
119
|
-
string encoding = 4;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
message htmlToPdfParams {
|
|
123
|
-
string html = 1;
|
|
124
|
-
string pdfPageConfig = 2;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
message pdfMergeParams {
|
|
128
|
-
repeated string mergeFiles = 1;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
message htmlToImageParams {
|
|
132
|
-
string html = 1;
|
|
133
|
-
string format = 2;
|
|
134
|
-
uint64 width = 3;
|
|
135
|
-
uint64 height = 4;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
message htmlToDocParams {
|
|
139
|
-
string html = 1;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
message FileBase64 {
|
|
143
|
-
string result = 1;
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
service Convert {
|
|
4
|
+
rpc HealthCheck (Empty) returns (HealthResponse);
|
|
5
|
+
rpc csvToXls(csvToXlsParams) returns (FileBase64) {}
|
|
6
|
+
rpc jsonToXls(jsonToXlsParams) returns (FileBase64) {}
|
|
7
|
+
rpc pdfMerge(pdfMergeParams) returns (FileBase64) {}
|
|
8
|
+
rpc htmlToPdf(htmlToPdfParams) returns (FileBase64) {}
|
|
9
|
+
rpc excelToJson(excelToJsonParams) returns (FileBase64) {}
|
|
10
|
+
rpc xmlToJson(xmlToJsonParams) returns (FileBase64) {}
|
|
11
|
+
rpc htmlToDoc(htmlToDocParams) returns (FileBase64) {}
|
|
12
|
+
rpc htmlToImage(htmlToImageParams) returns (FileBase64) {}
|
|
13
|
+
rpc geojsonToShp(geojsonToShpParams) returns (FileBase64) {}
|
|
14
|
+
rpc shpToGeojson(shpToGeojsonParams) returns (FileBase64) {}
|
|
15
|
+
rpc docToPDF(docToPDFParams) returns (FileBase64) {}
|
|
16
|
+
rpc mergeImages(mergeImagesIn) returns (FileBase64) {}
|
|
17
|
+
rpc resizeImage(resizeImageIn) returns (FileBase64) {}
|
|
18
|
+
rpc jsonToYaml(jsonToYamlIn) returns (FileBase64) {}
|
|
19
|
+
rpc yamlToJson(yamlToJsonIn) returns (FileBase64) {}
|
|
20
|
+
rpc log(log_in) returns (log_out) {}
|
|
21
|
+
rpc geojsonToGpkg(geojsonToShpParams) returns (FileBase64) {}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
message Empty {}
|
|
25
|
+
|
|
26
|
+
message HealthResponse {
|
|
27
|
+
string status = 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
message jsonToYamlIn {
|
|
31
|
+
string json = 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message yamlToJsonIn {
|
|
35
|
+
string yaml = 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message resizeImageIn {
|
|
39
|
+
string base64 = 1;
|
|
40
|
+
uint64 width = 2;
|
|
41
|
+
uint64 height = 3;
|
|
42
|
+
uint32 quality = 4;
|
|
43
|
+
uint32 subsampling = 5;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message pdfToImgIn {
|
|
47
|
+
string pdfPath = 1;
|
|
48
|
+
string imgPath = 2;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
message pdfToImgOut {
|
|
52
|
+
string imgPath = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message log_in {
|
|
56
|
+
uint32 rows = 1;
|
|
57
|
+
string level = 2;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
message log_out {
|
|
61
|
+
repeated string logs = 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
enum mergeImageFormat {
|
|
65
|
+
VERTICAL = 0;
|
|
66
|
+
HORIZONTAL = 1;
|
|
67
|
+
OVERLAY = 2;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
message imageMeta {
|
|
71
|
+
string base64 = 1;
|
|
72
|
+
mergeImageFormat mergeFormat = 2;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
message mergeImagesIn {
|
|
76
|
+
repeated string images = 1;
|
|
77
|
+
repeated imageMeta imagesMeta = 2;
|
|
78
|
+
string background = 3;
|
|
79
|
+
string mergeFormat = 4;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
message docToPDFParams {
|
|
83
|
+
string base64 = 1;
|
|
84
|
+
string to = 2;
|
|
85
|
+
string ext = 3;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
message shpToGeojsonParams {
|
|
89
|
+
string base64 = 1;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
message geojsonToShpParams {
|
|
93
|
+
string geojson = 1;
|
|
94
|
+
string proj = 2;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
message xmlToJsonParams {
|
|
98
|
+
string xml = 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
message jsonToXlsParams {
|
|
102
|
+
string json = 1;
|
|
103
|
+
string header = 2;
|
|
104
|
+
string subheader = 3;
|
|
105
|
+
string colmodel = 4;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
message csvToXlsParams {
|
|
109
|
+
string csv = 1;
|
|
110
|
+
string header = 2;
|
|
111
|
+
string subheader = 3;
|
|
112
|
+
string separator = 4;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
message excelToJsonParams {
|
|
116
|
+
string base64 = 1;
|
|
117
|
+
string type = 2;
|
|
118
|
+
string delimiter = 3;
|
|
119
|
+
string encoding = 4;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
message htmlToPdfParams {
|
|
123
|
+
string html = 1;
|
|
124
|
+
string pdfPageConfig = 2;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
message pdfMergeParams {
|
|
128
|
+
repeated string mergeFiles = 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
message htmlToImageParams {
|
|
132
|
+
string html = 1;
|
|
133
|
+
string format = 2;
|
|
134
|
+
uint64 width = 3;
|
|
135
|
+
uint64 height = 4;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
message htmlToDocParams {
|
|
139
|
+
string html = 1;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
message FileBase64 {
|
|
143
|
+
string result = 1;
|
|
144
144
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// TODO delete style when fully switch to the new code with merge
|
|
2
|
-
const createTemplate = ({ domain, html }) => `<!DOCTYPE html>\
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<base uri="http://${domain}/">
|
|
6
|
-
<meta charset="utf-8">
|
|
7
|
-
<style>html, body {font-size: 10pt !important;}</style>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
${html || ''}
|
|
11
|
-
</body>
|
|
2
|
+
const createTemplate = ({ domain, html }) => `<!DOCTYPE html>\
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<base uri="http://${domain}/">
|
|
6
|
+
<meta charset="utf-8">
|
|
7
|
+
<style>html, body {font-size: 10pt !important;}</style>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
${html || ''}
|
|
11
|
+
</body>
|
|
12
12
|
</html`;
|
|
13
13
|
export default createTemplate;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
service OfficeConverterService {
|
|
4
|
-
rpc OfficeToPdf(OfficeToPdfRequest) returns (OfficeToPdfResponse) {}
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
message OfficeToPdfRequest {
|
|
8
|
-
string file = 1;
|
|
9
|
-
string ext = 2;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
message OfficeToPdfResponse {
|
|
13
|
-
string file = 1;
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
service OfficeConverterService {
|
|
4
|
+
rpc OfficeToPdf(OfficeToPdfRequest) returns (OfficeToPdfResponse) {}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
message OfficeToPdfRequest {
|
|
8
|
+
string file = 1;
|
|
9
|
+
string ext = 2;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
message OfficeToPdfResponse {
|
|
13
|
+
string file = 1;
|
|
14
14
|
}
|
|
@@ -12,7 +12,7 @@ const rclient2 = getRedis({ db: 2 });
|
|
|
12
12
|
// const rclient10 = getRedis({ db: 10 });
|
|
13
13
|
const filesFolder = getFolder(config);
|
|
14
14
|
const redisKey = "logger-process-online";
|
|
15
|
-
const sqlQuery = `select datname as dbname, application_name as app, client_addr as client_ip,
|
|
15
|
+
const sqlQuery = `select datname as dbname, application_name as app, client_addr as client_ip,
|
|
16
16
|
(now()-backend_start)::text as msec, state, query from pg_stat_activity where datname=$1`;
|
|
17
17
|
const prev = {};
|
|
18
18
|
const cpuUsage = () => {
|
|
@@ -43,7 +43,7 @@ export default async function autoIndex({ table, columns: filter1, pg = pgClient
|
|
|
43
43
|
}
|
|
44
44
|
const cols = tbs
|
|
45
45
|
? await pg
|
|
46
|
-
.query(`SELECT attrelid::regclass AS tbl, attname AS aname, atttypid::regtype AS datatype, atttypid
|
|
46
|
+
.query(`SELECT attrelid::regclass AS tbl, attname AS aname, atttypid::regtype AS datatype, atttypid
|
|
47
47
|
FROM pg_attribute WHERE attrelid::regclass::text = $1 and attname = any($2::text[])`, [tbs, attrs])
|
|
48
48
|
.then((el) => el.rows || [])
|
|
49
49
|
: [];
|
|
@@ -78,13 +78,13 @@ export default async function autoIndex({ table, columns: filter1, pg = pgClient
|
|
|
78
78
|
qIndex.push(`CREATE INDEX if not exists ${name}_lower ON ${el.nspname}.${el.relname} USING ${indexUsing} (lower(${el.aname}) ${suffix})`);
|
|
79
79
|
}
|
|
80
80
|
if (indexUsing === "gist") {
|
|
81
|
-
qIndex.push(`CREATE INDEX if not exists ${name.replace("gist", "gist1")}
|
|
81
|
+
qIndex.push(`CREATE INDEX if not exists ${name.replace("gist", "gist1")}
|
|
82
82
|
ON ${el.nspname}.${el.relname} USING gist (${el.aname})`);
|
|
83
|
-
qIndex.push(`CREATE INDEX if not exists ${name.replace("gist", "area")}
|
|
83
|
+
qIndex.push(`CREATE INDEX if not exists ${name.replace("gist", "area")}
|
|
84
84
|
ON ${el.nspname}.${el.relname} USING btree (st_area(st_transform(${el.aname},3857)))`);
|
|
85
|
-
qIndex.push(`CREATE INDEX if not exists ${name.replace("gist", "area_true")}
|
|
85
|
+
qIndex.push(`CREATE INDEX if not exists ${name.replace("gist", "area_true")}
|
|
86
86
|
ON ${el.nspname}.${el.relname} USING btree (st_area(${el.aname}, true))`);
|
|
87
|
-
qIndex.push(`CREATE INDEX if not exists ${name.replace("gist", "4326")}
|
|
87
|
+
qIndex.push(`CREATE INDEX if not exists ${name.replace("gist", "4326")}
|
|
88
88
|
ON ${el.nspname}.${el.relname} USING gist (st_transform(${el.aname},4326))`);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -24,12 +24,12 @@ export default async function getMeta(opt, nocache) {
|
|
|
24
24
|
return data[pg.options.database][tableUnsafe];
|
|
25
25
|
}
|
|
26
26
|
const tableRows = await pg
|
|
27
|
-
.query(`SELECT
|
|
28
|
-
nspname || '.' || relname as name,
|
|
29
|
-
relkind
|
|
30
|
-
FROM pg_class a
|
|
31
|
-
JOIN pg_namespace b
|
|
32
|
-
ON b.oid = a.relnamespace
|
|
27
|
+
.query(`SELECT
|
|
28
|
+
nspname || '.' || relname as name,
|
|
29
|
+
relkind
|
|
30
|
+
FROM pg_class a
|
|
31
|
+
JOIN pg_namespace b
|
|
32
|
+
ON b.oid = a.relnamespace
|
|
33
33
|
WHERE relkind IN ('r', 'v', 'm')`)
|
|
34
34
|
.then((r) => r.rows || []);
|
|
35
35
|
const tlist = tableRows.map((el) => el.name);
|
|
@@ -42,9 +42,9 @@ export default async function getMeta(opt, nocache) {
|
|
|
42
42
|
.then((r) => r.fields || []);
|
|
43
43
|
// remove quotes from table names
|
|
44
44
|
const pks1 = await pg
|
|
45
|
-
.query(`SELECT json_object_agg(replace(c.conrelid::regclass::text,'"',''), a.attname)
|
|
46
|
-
FROM pg_constraint c
|
|
47
|
-
left join pg_attribute a on c.conrelid=a.attrelid and a.attnum = c.conkey[1]
|
|
45
|
+
.query(`SELECT json_object_agg(replace(c.conrelid::regclass::text,'"',''), a.attname)
|
|
46
|
+
FROM pg_constraint c
|
|
47
|
+
left join pg_attribute a on c.conrelid=a.attrelid and a.attnum = c.conkey[1]
|
|
48
48
|
WHERE c.contype='p'::"char"`)
|
|
49
49
|
.then((r) => r.rows[0].json_object_agg || {});
|
|
50
50
|
const pk = tableUnsafe.startsWith("public.")
|
|
@@ -53,12 +53,12 @@ export default async function getMeta(opt, nocache) {
|
|
|
53
53
|
const geomColumns = fields.filter((el) => pg.pgType?.[el.dataTypeID] === "geometry");
|
|
54
54
|
const geomAttr = geomColumns.find((el) => el.name === "geom_4326") || geomColumns[0];
|
|
55
55
|
const dbColumns = await pg
|
|
56
|
-
.query(`select json_object_agg(
|
|
57
|
-
attname,
|
|
58
|
-
json_build_object(
|
|
59
|
-
'title', pg_catalog.col_description(attrelid,attnum)
|
|
60
|
-
)
|
|
61
|
-
) from pg_catalog.pg_attribute
|
|
56
|
+
.query(`select json_object_agg(
|
|
57
|
+
attname,
|
|
58
|
+
json_build_object(
|
|
59
|
+
'title', pg_catalog.col_description(attrelid,attnum)
|
|
60
|
+
)
|
|
61
|
+
) from pg_catalog.pg_attribute
|
|
62
62
|
where attrelid=$1::regclass and attnum>0 and NOT attisdropped`, [tableSafe])
|
|
63
63
|
.then((el) => el.rows?.[0]?.json_object_agg || {});
|
|
64
64
|
fields.forEach((el) => Object.assign(el, { ...(dbColumns[el.name] || {}) }));
|
|
@@ -22,15 +22,15 @@ async function init(client) {
|
|
|
22
22
|
.query(`SELECT json_object_agg(t.oid:: text, pg_catalog.format_type(t.oid, NULL)) FROM pg_catalog.pg_type t`)
|
|
23
23
|
.then((el) => el.rows[0]?.json_object_agg || {});
|
|
24
24
|
const pks = await client
|
|
25
|
-
.query(`
|
|
26
|
-
SELECT
|
|
27
|
-
connamespace::regnamespace::text,
|
|
28
|
-
conrelid::regclass,
|
|
29
|
-
(
|
|
30
|
-
SELECT attname FROM pg_attribute WHERE attrelid = c.conrelid AND attnum = c.conkey[1]
|
|
31
|
-
) as pk
|
|
32
|
-
FROM pg_constraint c
|
|
33
|
-
WHERE contype = 'p'
|
|
25
|
+
.query(`
|
|
26
|
+
SELECT
|
|
27
|
+
connamespace::regnamespace::text,
|
|
28
|
+
conrelid::regclass,
|
|
29
|
+
(
|
|
30
|
+
SELECT attname FROM pg_attribute WHERE attrelid = c.conrelid AND attnum = c.conkey[1]
|
|
31
|
+
) as pk
|
|
32
|
+
FROM pg_constraint c
|
|
33
|
+
WHERE contype = 'p'
|
|
34
34
|
AND connamespace::regnamespace::text NOT IN ('sde')`)
|
|
35
35
|
.then((el) => el.rows || []);
|
|
36
36
|
const pk = pks.reduce((acc, curr) => ({
|
|
@@ -40,36 +40,36 @@ async function init(client) {
|
|
|
40
40
|
: curr.conrelid]: curr.pk,
|
|
41
41
|
}), {});
|
|
42
42
|
const tlist = await client
|
|
43
|
-
.query(`SELECT
|
|
44
|
-
array_agg(
|
|
45
|
-
(
|
|
46
|
-
SELECT
|
|
47
|
-
nspname
|
|
48
|
-
FROM
|
|
49
|
-
pg_namespace
|
|
50
|
-
WHERE
|
|
51
|
-
oid = relnamespace
|
|
52
|
-
) || '.' || relname
|
|
53
|
-
) tlist
|
|
54
|
-
FROM
|
|
55
|
-
pg_class
|
|
56
|
-
WHERE
|
|
43
|
+
.query(`SELECT
|
|
44
|
+
array_agg(
|
|
45
|
+
(
|
|
46
|
+
SELECT
|
|
47
|
+
nspname
|
|
48
|
+
FROM
|
|
49
|
+
pg_namespace
|
|
50
|
+
WHERE
|
|
51
|
+
oid = relnamespace
|
|
52
|
+
) || '.' || relname
|
|
53
|
+
) tlist
|
|
54
|
+
FROM
|
|
55
|
+
pg_class
|
|
56
|
+
WHERE
|
|
57
57
|
relkind IN ('r', 'v', 'm')`)
|
|
58
58
|
.then((d) => d.rows[0].tlist);
|
|
59
59
|
const rows = await client
|
|
60
|
-
.query(`SELECT
|
|
61
|
-
(
|
|
62
|
-
SELECT
|
|
63
|
-
nspname
|
|
64
|
-
FROM
|
|
65
|
-
pg_namespace
|
|
66
|
-
WHERE
|
|
67
|
-
oid = relnamespace
|
|
68
|
-
) || '.' || relname AS tname,
|
|
69
|
-
relkind
|
|
70
|
-
FROM
|
|
71
|
-
pg_class
|
|
72
|
-
WHERE
|
|
60
|
+
.query(`SELECT
|
|
61
|
+
(
|
|
62
|
+
SELECT
|
|
63
|
+
nspname
|
|
64
|
+
FROM
|
|
65
|
+
pg_namespace
|
|
66
|
+
WHERE
|
|
67
|
+
oid = relnamespace
|
|
68
|
+
) || '.' || relname AS tname,
|
|
69
|
+
relkind
|
|
70
|
+
FROM
|
|
71
|
+
pg_class
|
|
72
|
+
WHERE
|
|
73
73
|
relkind IN ('r', 'v', 'm')`)
|
|
74
74
|
.then((el) => el.rows || []);
|
|
75
75
|
const relkinds = rows.reduce((acc, curr) => Object.assign(acc, { [curr.tname]: curr.relkind }), {});
|