@opengis/fastify-table 2.4.12 → 2.4.14
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/server/plugins/logger/errorStatus.js +3 -3
- package/dist/server/routes/auth/controllers/2factor/verify.d.ts.map +1 -1
- package/dist/server/routes/auth/controllers/2factor/verify.js +5 -4
- package/dist/server/routes/file/controllers/export.d.ts.map +1 -1
- package/dist/server/routes/file/controllers/export.js +24 -0
- package/package.json +1 -1
|
@@ -7,13 +7,13 @@ function errorStatus(error) {
|
|
|
7
7
|
return 422;
|
|
8
8
|
}
|
|
9
9
|
if (error.routine === "exec_stmt_raise" && error.file === "pl_exec.c") {
|
|
10
|
-
return
|
|
10
|
+
return 422;
|
|
11
11
|
}
|
|
12
12
|
if (error.routine === "ExecConstraints") {
|
|
13
|
-
return
|
|
13
|
+
return 422;
|
|
14
14
|
}
|
|
15
15
|
if (error.type === "DatabaseError") {
|
|
16
|
-
return
|
|
16
|
+
return 500;
|
|
17
17
|
}
|
|
18
18
|
if (error.statusCode) {
|
|
19
19
|
return error.statusCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/2factor/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA2BvC;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAA8B,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/2factor/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA2BvC;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAA8B,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,kBA2DzE"}
|
|
@@ -67,8 +67,9 @@ export default async function verifyFunction(req, reply) {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
const redirectUrl = req.headers?.referer?.match?.(/[?&]redirect=([^&]+)/)?.[1] || "/";
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
.status(200)
|
|
73
|
-
|
|
70
|
+
const safeRedirectUrl = redirectUrl.startsWith("/") ? redirectUrl : "/";
|
|
71
|
+
if (req.method === "POST") {
|
|
72
|
+
return reply.status(200).send({ redirectUrl: safeRedirectUrl });
|
|
73
|
+
}
|
|
74
|
+
return reply.redirect(safeRedirectUrl);
|
|
74
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../../../server/routes/file/controllers/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAiCzD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAA8B,WAAW,CACvC,EACE,EAAqB,EACrB,OAAO,EACP,IAAI,EACJ,OAAO,EAAE,QAAQ,EACjB,GAAG,EACH,KAAU,EACV,IAAkB,EAClB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EACD,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../../../server/routes/file/controllers/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAiCzD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAA8B,WAAW,CACvC,EACE,EAAqB,EACrB,OAAO,EACP,IAAI,EACJ,OAAO,EAAE,QAAQ,EACjB,GAAG,EACH,KAAU,EACV,IAAkB,EAClB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EACD,KAAK,EAAE,YAAY,gBAgbpB"}
|
|
@@ -95,6 +95,29 @@ export default async function exportTable({ pg = pgClients.client, headers, user
|
|
|
95
95
|
if (format === "geojson" && !meta?.geom) {
|
|
96
96
|
throw BadRequestError("Ця форма не містить полів геометрії. Виберіть тип, який не потребує геометрії для вивантаження");
|
|
97
97
|
}
|
|
98
|
+
const checkQueryColsValid = () => {
|
|
99
|
+
if (!query.cols)
|
|
100
|
+
return true;
|
|
101
|
+
if (typeof query.cols !== "string")
|
|
102
|
+
return false;
|
|
103
|
+
if (loadTable && loadTable.columns) {
|
|
104
|
+
return (loadTable.columns
|
|
105
|
+
.map((col) => col.name)
|
|
106
|
+
.filter((colname) => query.cols.split(",").includes(colname))
|
|
107
|
+
.length === query.cols.split(",").length);
|
|
108
|
+
}
|
|
109
|
+
if (meta && meta.columns) {
|
|
110
|
+
return (meta.columns
|
|
111
|
+
.map((col) => col.name)
|
|
112
|
+
.filter((colname) => query.cols.split(",").includes(colname))
|
|
113
|
+
.length === query.cols.split(",").length);
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
};
|
|
117
|
+
const isQueryColsValid = checkQueryColsValid();
|
|
118
|
+
if (!isQueryColsValid) {
|
|
119
|
+
throw BadRequestError("invalid query params: cols");
|
|
120
|
+
}
|
|
98
121
|
const options = {
|
|
99
122
|
pg,
|
|
100
123
|
params: {
|
|
@@ -111,6 +134,7 @@ export default async function exportTable({ pg = pgClients.client, headers, user
|
|
|
111
134
|
user,
|
|
112
135
|
sufix: false,
|
|
113
136
|
isExport: true,
|
|
137
|
+
columns: cols,
|
|
114
138
|
};
|
|
115
139
|
// check total count, debug sql etc.
|
|
116
140
|
const result = tableSql || viewSql
|