@opengis/fastify-table 2.0.111 → 2.0.113
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/helper.d.ts +8 -0
- package/dist/helper.d.ts.map +1 -0
- package/dist/helper.js +34 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/module/core/cls/constraint_action.json +10 -0
- package/dist/module/core/cls/constraint_matchtype.json +6 -0
- package/dist/module/core/cls/constraint_type.json +14 -0
- package/dist/module/core/cls/constraint_type_full.json +18 -0
- package/dist/module/core/cls/constraint_type_table.json +18 -0
- package/dist/module/core/cls/core.user_type.json +14 -0
- package/dist/module/core/pt/schemaItem.pt.hbs +18 -0
- package/dist/module/core/select/core.user_mentioned.sql +2 -0
- package/dist/script/dump.d.ts +2 -0
- package/dist/script/dump.d.ts.map +1 -0
- package/dist/script/dump.js +102 -129
- package/dist/script/dump.ts +205 -0
- package/dist/script/migrate.d.ts +2 -0
- package/dist/script/migrate.d.ts.map +1 -0
- package/dist/script/migrate.js +24 -25
- package/dist/script/migrate.ts +31 -0
- package/dist/server/plugins/sqlite/funcs/getSqlite.d.ts.map +1 -1
- package/dist/server/plugins/sqlite/funcs/getSqlite.js +1 -2
- package/dist/server/plugins/sqlite/sqliteClients.d.ts.map +1 -1
- package/dist/server/plugins/sqlite/sqliteClients.js +1 -2
- package/dist/server/plugins/table/funcs/getColumnCLS.d.ts.map +1 -1
- package/dist/server/plugins/table/funcs/getColumnCLS.js +18 -7
- package/dist/server/plugins/util/funcs/eventStream.d.ts +4 -1
- package/dist/server/plugins/util/funcs/eventStream.d.ts.map +1 -1
- package/dist/server/routes/file/controllers/export.d.ts.map +1 -1
- package/dist/server/routes/file/controllers/export.js +21 -14
- package/dist/server/routes/file/controllers/utils/pubsub.d.ts +2 -0
- package/dist/server/routes/file/controllers/utils/pubsub.d.ts.map +1 -0
- package/dist/server/routes/file/controllers/utils/pubsub.js +112 -0
- package/dist/server/routes/table/controllers/dataInfo.d.ts +8 -1
- package/dist/server/routes/table/controllers/dataInfo.d.ts.map +1 -1
- package/dist/server/routes/table/controllers/dataInfo.js +7 -5
- package/dist/server/types/core.d.ts.map +1 -1
- package/dist/server/types/core.js +0 -1
- package/dist/test.setup.js +0 -1
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +3 -0
- package/package.json +5 -4
- package/dist/log/migration/dist-geoname-cls.json +0 -1
- package/dist/log/migration/dist-geoname-cls.sql +0 -0
- package/dist/server/plugins/upload/finishUpload.d.ts +0 -9
- package/dist/server/plugins/upload/finishUpload.d.ts.map +0 -1
- package/dist/server/plugins/upload/finishUpload.js +0 -33
- package/dist/server/plugins/util/funcs/routeOptions.d.ts +0 -3
- package/dist/server/plugins/util/funcs/routeOptions.d.ts.map +0 -1
- package/dist/server/plugins/util/funcs/routeOptions.js +0 -2
- package/dist/server/routes/auth/controllers/2factor/generate.d.ts +0 -19
- package/dist/server/routes/auth/controllers/2factor/generate.d.ts.map +0 -1
- package/dist/server/routes/auth/controllers/2factor/generate.js +0 -38
- package/dist/server/routes/auth/controllers/2factor/toggle.d.ts +0 -18
- package/dist/server/routes/auth/controllers/2factor/toggle.d.ts.map +0 -1
- package/dist/server/routes/auth/controllers/2factor/toggle.js +0 -39
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../script/migrate.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,OAAO,SAiB9B"}
|
package/dist/script/migrate.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import Fastify from
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const app = Fastify();
|
|
11
|
-
|
|
12
|
-
app.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
1
|
+
import Fastify from "fastify";
|
|
2
|
+
import config from "../config.js";
|
|
3
|
+
import plugin from "../index.js";
|
|
4
|
+
const timeoutMs = +(config.migrationTimeout || 5000);
|
|
5
|
+
const port = process.env.PORT || config.port || 3000;
|
|
6
|
+
if (import.meta.main) {
|
|
7
|
+
migrate();
|
|
8
|
+
}
|
|
9
|
+
export default function migrate() {
|
|
10
|
+
const app = Fastify();
|
|
11
|
+
app.register(plugin, config);
|
|
12
|
+
app.listen({ host: "0.0.0.0", port }, (err) => {
|
|
13
|
+
console.log(`Server started via port: ${port}`);
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
console.log("Server closed after timeout", timeoutMs);
|
|
16
|
+
app.close();
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}, timeoutMs);
|
|
19
|
+
if (err) {
|
|
20
|
+
console.error("migrations error", err.toString());
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Fastify from "fastify";
|
|
2
|
+
|
|
3
|
+
import config from "../config.js";
|
|
4
|
+
import plugin from "../index.js";
|
|
5
|
+
|
|
6
|
+
const timeoutMs = +(config.migrationTimeout || 5000);
|
|
7
|
+
|
|
8
|
+
const port = process.env.PORT || config.port || 3000;
|
|
9
|
+
|
|
10
|
+
if (import.meta.main) {
|
|
11
|
+
migrate();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function migrate() {
|
|
15
|
+
const app = Fastify();
|
|
16
|
+
|
|
17
|
+
app.register(plugin, config);
|
|
18
|
+
|
|
19
|
+
app.listen({ host: "0.0.0.0", port }, (err: any) => {
|
|
20
|
+
console.log(`Server started via port: ${port}`);
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
console.log("Server closed after timeout", timeoutMs);
|
|
23
|
+
app.close();
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}, timeoutMs);
|
|
26
|
+
if (err) {
|
|
27
|
+
console.error("migrations error", err.toString());
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSqlite.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/sqlite/funcs/getSqlite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getSqlite.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/sqlite/funcs/getSqlite.ts"],"names":[],"mappings":"AAcA,iBAAS,cAAc,CAAC,EACtB,IAAI,EACJ,QAAgB,EAChB,aAAqB,EACrB,iBAAiB,EAAE,OAAe,GACnC,GAAE,GAAQ,OAqBV;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -2,8 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
const { name: execName } = path.parse(process.argv0);
|
|
3
3
|
// import Database from 'better-sqlite3'; // error with bun
|
|
4
4
|
const { default: Database } = execName === "bun"
|
|
5
|
-
?
|
|
6
|
-
{ default: (await import("bun:sqlite")).Database }
|
|
5
|
+
? { default: (await import("bun:sqlite")).Database }
|
|
7
6
|
: await import("better-sqlite3");
|
|
8
7
|
import config from "../../../../config.js";
|
|
9
8
|
import sqliteClients from "../sqliteClients.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqliteClients.d.ts","sourceRoot":"","sources":["../../../../server/plugins/sqlite/sqliteClients.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqliteClients.d.ts","sourceRoot":"","sources":["../../../../server/plugins/sqlite/sqliteClients.ts"],"names":[],"mappings":"AAcA,QAAA,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,CAAC;AAkB9C,eAAe,aAAa,CAAC"}
|
|
@@ -2,8 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
const { name: execName } = path.parse(process.argv0);
|
|
3
3
|
// import Database from 'better-sqlite3';
|
|
4
4
|
const { default: Database } = execName === "bun"
|
|
5
|
-
?
|
|
6
|
-
{ default: (await import("bun:sqlite")).Database }
|
|
5
|
+
? { default: (await import("bun:sqlite")).Database }
|
|
7
6
|
: await import("better-sqlite3");
|
|
8
7
|
import config from "../../../config.js";
|
|
9
8
|
import init from "./funcs/init.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getColumnCLS.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/table/funcs/getColumnCLS.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getColumnCLS.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/table/funcs/getColumnCLS.ts"],"names":[],"mappings":"AA+CA,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,OA+BjE"}
|
|
@@ -3,17 +3,11 @@ import config from "../../../../config.js";
|
|
|
3
3
|
import loadTemplate from "./loadTemplate.js";
|
|
4
4
|
import getTemplates from "./getTemplates.js";
|
|
5
5
|
import getTemplateSync from "./getTemplateSync.js";
|
|
6
|
-
const cls = getTemplates("cls")
|
|
7
|
-
.map((el) => el[0])
|
|
8
|
-
.reduce((acc, curr) => ({ ...acc, [curr]: curr }), {});
|
|
9
|
-
const select = getTemplates("select")
|
|
10
|
-
.map((el) => el[0])
|
|
11
|
-
.reduce((acc, curr) => ({ ...acc, [curr]: curr }), {});
|
|
12
6
|
const exists = existsSync("module/cls.json");
|
|
7
|
+
const select = {};
|
|
13
8
|
const json = exists
|
|
14
9
|
? JSON.parse(readFileSync("module/cls.json", "utf-8") || "{}")
|
|
15
10
|
: {};
|
|
16
|
-
Object.assign(json, cls, select);
|
|
17
11
|
function getColumnCLSData(table, name) {
|
|
18
12
|
const type = select[`${table}.${name}`] || select[name || ""]
|
|
19
13
|
? "select"
|
|
@@ -45,6 +39,23 @@ function getColumnCLSData(table, name) {
|
|
|
45
39
|
: json;
|
|
46
40
|
}
|
|
47
41
|
export default function getColumnCLS(table, name) {
|
|
42
|
+
// init only
|
|
43
|
+
if (!Object.keys("select").length) {
|
|
44
|
+
const cls = getTemplates("cls")
|
|
45
|
+
.map((el) => el[0])
|
|
46
|
+
.reduce((acc, curr) => ({
|
|
47
|
+
...acc,
|
|
48
|
+
[curr]: curr,
|
|
49
|
+
}), {});
|
|
50
|
+
const selects = getTemplates("select")
|
|
51
|
+
.map((el) => el[0])
|
|
52
|
+
.reduce((acc, curr) => ({
|
|
53
|
+
...acc,
|
|
54
|
+
[curr]: curr,
|
|
55
|
+
}), {});
|
|
56
|
+
Object.assign(select, selects);
|
|
57
|
+
Object.assign(json, cls, select);
|
|
58
|
+
}
|
|
48
59
|
const key = [name, table, "column-cls"].filter(Boolean).join("-");
|
|
49
60
|
if (loadTemplate[key] && !config.local) {
|
|
50
61
|
return loadTemplate[key];
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export default function eventStream(res: any):
|
|
1
|
+
export default function eventStream(res: any): {
|
|
2
|
+
(...data: any[]): void;
|
|
3
|
+
(message?: any, ...optionalParams: any[]): void;
|
|
4
|
+
};
|
|
2
5
|
//# sourceMappingURL=eventStream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventStream.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/util/funcs/eventStream.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,GAAG,EAAE,GAAG
|
|
1
|
+
{"version":3,"file":"eventStream.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/util/funcs/eventStream.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,GAAG,EAAE,GAAG;;;EA0B3C"}
|
|
@@ -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;
|
|
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;AAgCzD;;;;;;;;;;;;;;;;;;;;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,gBAsYpB"}
|
|
@@ -20,6 +20,7 @@ import jsonToXls from "./utils/jsonToXls.js";
|
|
|
20
20
|
import jsonToCsv from "./utils/jsonToCsv.js";
|
|
21
21
|
import formatResult from "./utils/formatResult.js";
|
|
22
22
|
import jsonlToJsonFile from "./utils/jsonlToJsonFile.js";
|
|
23
|
+
import pubsub from "./utils/pubsub.js";
|
|
23
24
|
const startStreamWithTotal = 10000;
|
|
24
25
|
const rootDir = getFolder(config, "local");
|
|
25
26
|
/**
|
|
@@ -84,12 +85,6 @@ export default async function exportTable({ pg = pgClients.client, headers, user
|
|
|
84
85
|
reply,
|
|
85
86
|
});
|
|
86
87
|
}
|
|
87
|
-
// delete old file, prevent append
|
|
88
|
-
if (cacheFile && (nocache || config.disableCache)) {
|
|
89
|
-
await rm(filePath);
|
|
90
|
-
}
|
|
91
|
-
// create directory if not exists
|
|
92
|
-
await mkdir(path.dirname(filePath), { recursive: true });
|
|
93
88
|
const loadTable = await getTemplate("table", table);
|
|
94
89
|
const meta = await getMeta({ pg, table: loadTable?.table || table });
|
|
95
90
|
const viewSql = await getTemplate("view", loadTable?.table || table);
|
|
@@ -165,12 +160,22 @@ export default async function exportTable({ pg = pgClients.client, headers, user
|
|
|
165
160
|
.split(".")
|
|
166
161
|
.pop()}` // check for json data
|
|
167
162
|
: el.name);
|
|
168
|
-
const
|
|
169
|
-
process.env.NODE_ENV !== "test"
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
163
|
+
const isStream = ((!slice && +filtered > startStreamWithTotal) || stream) &&
|
|
164
|
+
process.env.NODE_ENV !== "test" &&
|
|
165
|
+
!process.env.VITEST;
|
|
166
|
+
const sendOriginal = isStream ? eventStream(reply) : () => { };
|
|
167
|
+
const redisKey = `exportTable:${fileName}`;
|
|
168
|
+
const send = isStream
|
|
169
|
+
? await pubsub(redisKey, (msg, finishStream = false) => {
|
|
170
|
+
sendOriginal(msg, finishStream);
|
|
171
|
+
}, query.reload && user?.user_type?.includes?.("admin"))
|
|
172
|
+
: () => { };
|
|
173
|
+
// delete old file, prevent append
|
|
174
|
+
if (cacheFile && (nocache || config.disableCache)) {
|
|
175
|
+
await rm(filePath);
|
|
176
|
+
}
|
|
177
|
+
// create directory if not exists
|
|
178
|
+
await mkdir(path.dirname(filePath), { recursive: true });
|
|
174
179
|
// export xlsx / csv / json
|
|
175
180
|
const source = loadTable?.title || loadTable?.ua || table || sourceName;
|
|
176
181
|
const interval = setInterval(async () => {
|
|
@@ -248,7 +253,8 @@ export default async function exportTable({ pg = pgClients.client, headers, user
|
|
|
248
253
|
await jsonlToJsonFile(filePathJSON.replace(/.json$/, ".jsonl"));
|
|
249
254
|
clearInterval(interval);
|
|
250
255
|
if (res.error) {
|
|
251
|
-
send(
|
|
256
|
+
send("finish");
|
|
257
|
+
sendOriginal(res.error, 1);
|
|
252
258
|
return reply.status(500).send(res.error);
|
|
253
259
|
}
|
|
254
260
|
logger.file("export/table", {
|
|
@@ -302,7 +308,8 @@ export default async function exportTable({ pg = pgClients.client, headers, user
|
|
|
302
308
|
if (resp.error) {
|
|
303
309
|
return reply.status(resp.status || 500).send(resp.error);
|
|
304
310
|
}
|
|
305
|
-
send("
|
|
311
|
+
send("finish");
|
|
312
|
+
sendOriginal("Файл успішно сформовано. Натистіть кнопку ще раз для завантаження даних", 1);
|
|
306
313
|
return formatResult({
|
|
307
314
|
filePath,
|
|
308
315
|
formatAnswer,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/file/controllers/utils/pubsub.ts"],"names":[],"mappings":"AAkDA,wBAA8B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,gBA2EzE"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const keyCacheSubscribe = "emit_cache";
|
|
2
|
+
const listenter = {}; // callback send message listener
|
|
3
|
+
const promise = {}; // promise await for subscribe
|
|
4
|
+
const resolve = {}; // resolve
|
|
5
|
+
const publish = {}; // publish
|
|
6
|
+
import config from "../../../../../config.js";
|
|
7
|
+
import getRedis from "../../../../plugins/redis/funcs/getRedis.js";
|
|
8
|
+
// getRedisPublisher
|
|
9
|
+
function getRedisPublisher() {
|
|
10
|
+
const rst = getRedis({
|
|
11
|
+
name: "rst",
|
|
12
|
+
...(config.redis || {}),
|
|
13
|
+
});
|
|
14
|
+
const subscriber = getRedis({
|
|
15
|
+
name: "sub",
|
|
16
|
+
...(config.redis || {}),
|
|
17
|
+
});
|
|
18
|
+
subscriber.unsubscribe(keyCacheSubscribe);
|
|
19
|
+
subscriber.subscribe(keyCacheSubscribe, () => { });
|
|
20
|
+
subscriber.on("message", async (channel, text) => {
|
|
21
|
+
const [code, msg] = text.split("|||");
|
|
22
|
+
if (msg === "finish" && resolve[code]) {
|
|
23
|
+
resolve[code]();
|
|
24
|
+
resolve[code] = null;
|
|
25
|
+
}
|
|
26
|
+
listenter[code].forEach((cb1, i) => {
|
|
27
|
+
cb1(`${msg} - ${i}`);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return rst;
|
|
31
|
+
}
|
|
32
|
+
// native publisher
|
|
33
|
+
function getPublisher() {
|
|
34
|
+
const rst = {
|
|
35
|
+
publish(key, text) {
|
|
36
|
+
const [code, msg] = text.split("|||");
|
|
37
|
+
listenter[code]?.forEach((cb1, i) => {
|
|
38
|
+
cb1?.(`${msg} - ${i}`);
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
return rst;
|
|
43
|
+
}
|
|
44
|
+
// !!! work non cluster mode for cluster subscribe redis
|
|
45
|
+
export default async function subscribe(code, cb, reload) {
|
|
46
|
+
try {
|
|
47
|
+
const rclient = getRedis();
|
|
48
|
+
const { isRedis, timeout = 150 } = config?.redis?.pubsub || {}; // test!
|
|
49
|
+
const publisher = isRedis ? getRedisPublisher() : getPublisher();
|
|
50
|
+
const keyCacheCode = `${keyCacheSubscribe}:${code}`;
|
|
51
|
+
// check code is run
|
|
52
|
+
const isNotRun = await rclient.setnx(keyCacheCode, 1);
|
|
53
|
+
const ttl = await rclient.ttl(keyCacheCode);
|
|
54
|
+
// if Run
|
|
55
|
+
if (!isNotRun && !reload && ttl > 0) {
|
|
56
|
+
// add listener
|
|
57
|
+
cb(`==== run as slave ttl: ${ttl}==== `);
|
|
58
|
+
const alldata = await rclient.lrange(keyCacheCode + ":list", 0, -1);
|
|
59
|
+
alldata.forEach((el) => {
|
|
60
|
+
cb(el);
|
|
61
|
+
});
|
|
62
|
+
// for redis
|
|
63
|
+
if (!listenter[code]) {
|
|
64
|
+
listenter[code] = [];
|
|
65
|
+
promise[code] = new Promise((rsv) => {
|
|
66
|
+
resolve[code] = rsv;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// check master finish
|
|
70
|
+
const interval = setInterval(async () => {
|
|
71
|
+
const ttl1 = await rclient.ttl(keyCacheCode);
|
|
72
|
+
if (ttl1 < 0) {
|
|
73
|
+
clearInterval(interval);
|
|
74
|
+
cb(`finish master timeout ${timeout}`, 1);
|
|
75
|
+
}
|
|
76
|
+
}, 5000);
|
|
77
|
+
listenter[code].push(cb);
|
|
78
|
+
return promise[code];
|
|
79
|
+
}
|
|
80
|
+
await rclient.expire(keyCacheCode, timeout);
|
|
81
|
+
// if not run
|
|
82
|
+
// create return promise
|
|
83
|
+
promise[code] = new Promise((rsv) => {
|
|
84
|
+
resolve[code] = rsv;
|
|
85
|
+
});
|
|
86
|
+
listenter[code] = [cb];
|
|
87
|
+
// listenter[code].push(cb);
|
|
88
|
+
// create publish function
|
|
89
|
+
publish[code] = (msg) => {
|
|
90
|
+
rclient.rpush(keyCacheCode + ":list", msg);
|
|
91
|
+
rclient.expire(keyCacheCode, timeout);
|
|
92
|
+
// send message to all listener
|
|
93
|
+
publisher.publish(keyCacheSubscribe, `${code}|||${msg}`); // redis
|
|
94
|
+
// finish and clear
|
|
95
|
+
if (msg === "finish") {
|
|
96
|
+
// clear code to run again
|
|
97
|
+
rclient.del(keyCacheCode);
|
|
98
|
+
rclient.del(keyCacheCode + ":list");
|
|
99
|
+
// resolve promise
|
|
100
|
+
resolve[code]();
|
|
101
|
+
// clear
|
|
102
|
+
resolve[code] = null;
|
|
103
|
+
promise[code] = null;
|
|
104
|
+
listenter[code] = [];
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return publish[code];
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
console.error(err.toString());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -8,5 +8,12 @@ export default function dataInfo({ pg, params, query, }: {
|
|
|
8
8
|
query: {
|
|
9
9
|
table?: string;
|
|
10
10
|
};
|
|
11
|
-
}, reply: FastifyReply): Promise<
|
|
11
|
+
}, reply: FastifyReply): Promise<{
|
|
12
|
+
table: any;
|
|
13
|
+
columns: any;
|
|
14
|
+
rows: any;
|
|
15
|
+
cls: any;
|
|
16
|
+
sufix: boolean;
|
|
17
|
+
time: number;
|
|
18
|
+
}>;
|
|
12
19
|
//# sourceMappingURL=dataInfo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataInfo.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/dataInfo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataInfo.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/dataInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAYzD,wBAA8B,QAAQ,CACpC,EACE,EAAqB,EACrB,MAAW,EACX,KAAU,GACX,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,MAAM,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,KAAK,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3B,EACD,KAAK,EAAE,YAAY;;;;;;;GA0EpB"}
|
|
@@ -5,12 +5,14 @@ import metaFormat from "../../../plugins/table/funcs/metaFormat/index.js";
|
|
|
5
5
|
import getTemplatePath from "../../../plugins/table/funcs/getTemplatePath.js";
|
|
6
6
|
import yml2json from "../../../plugins/yml/funcs/yml2json.js";
|
|
7
7
|
const infoList = [];
|
|
8
|
-
const infoTemplateList = getTemplatePath("info")?.filter?.((el, idx, arr) => arr.findIndex((item) => item[1] === el[1]) === idx);
|
|
9
|
-
infoTemplateList?.forEach?.((el) => {
|
|
10
|
-
const info = yml2json(readFileSync(el[1], "utf-8"));
|
|
11
|
-
infoList.push(info);
|
|
12
|
-
});
|
|
13
8
|
export default async function dataInfo({ pg = pgClients.client, params = {}, query = {}, }, reply) {
|
|
9
|
+
if (!infoList.length) {
|
|
10
|
+
const infoTemplateList = getTemplatePath("info")?.filter?.((el, idx, arr) => arr.findIndex((item) => item[1] === el[1]) === idx);
|
|
11
|
+
infoTemplateList?.forEach?.((el) => {
|
|
12
|
+
const info = yml2json(readFileSync(el[1], "utf-8"));
|
|
13
|
+
infoList.push(info);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
14
16
|
const timeStart = Date.now();
|
|
15
17
|
const { id } = params;
|
|
16
18
|
const { table } = query;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../server/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAM1B,QAAA,IAAI,QAAQ,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../server/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAM1B,QAAA,IAAI,QAAQ,EAAE,GAAG,CAAC;AASlB,MAAM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,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,YAAY,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;QAC7C,MAAM,EAAE,0BAA0B,CAAC;KACpC,CAAC;CACH;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,OAAO,QAAQ,CAAC;IACnE,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,0BAA2B,SAAQ,oBAAoB;IACtE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
package/dist/test.setup.js
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -85,6 +85,8 @@ export { default as getUploadStatus } from "./server/plugins/upload/getUploadSta
|
|
|
85
85
|
export { default as startUpload } from "./server/plugins/upload/startUpload.js";
|
|
86
86
|
export { default as uploadChunk } from "./server/plugins/upload/uploadChunk.js";
|
|
87
87
|
export { default as s3Client } from "./server/plugins/file/providers/s3/client.js";
|
|
88
|
+
export { default as dumpDatabase } from "./script/dump.js";
|
|
89
|
+
export { default as migrate } from "./script/migrate.js";
|
|
88
90
|
declare const _default: null;
|
|
89
91
|
export default _default;
|
|
90
92
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAGhF,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAGvF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,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IAAI,kBAAkB,EAC7B,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AAGnF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC;;AAEzD,wBAAoB"}
|
package/dist/utils.js
CHANGED
|
@@ -102,4 +102,7 @@ export { default as getUploadStatus } from "./server/plugins/upload/getUploadSta
|
|
|
102
102
|
export { default as startUpload } from "./server/plugins/upload/startUpload.js";
|
|
103
103
|
export { default as uploadChunk } from "./server/plugins/upload/uploadChunk.js";
|
|
104
104
|
export { default as s3Client } from "./server/plugins/file/providers/s3/client.js";
|
|
105
|
+
// scripts
|
|
106
|
+
export { default as dumpDatabase } from "./script/dump.js";
|
|
107
|
+
export { default as migrate } from "./script/migrate.js";
|
|
105
108
|
export default null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengis/fastify-table",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.113",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "core-plugins",
|
|
6
6
|
"keywords": [
|
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
"dist/*"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
+
"dump": "bun ./dist/script/dump.js",
|
|
25
|
+
"migrate": "MIGRATE=true bun ./dist/script/migrate.js",
|
|
24
26
|
"prepublishOnly": "npm run build",
|
|
25
27
|
"clean": "tsc -b --clean",
|
|
26
|
-
"build": "tsc -b --clean && tsc && copyfiles server/plugins/grpc/utils/*.proto dist && copyfiles server/migrations/*.sql dist && copyfiles server/templates/**/*.html dist && copyfiles server/templates/**/*.hbs dist && copyfiles script/* dist",
|
|
28
|
+
"build": "tsc -b --clean && tsc && copyfiles server/plugins/grpc/utils/*.proto dist && copyfiles server/migrations/*.sql dist && copyfiles server/templates/**/*.html dist && copyfiles server/templates/**/*.hbs dist && copyfiles script/* dist && copyfiles -u 2 module/core/*/* dist/module/core",
|
|
27
29
|
"prod": "NODE_ENV=production bun dist/server",
|
|
28
|
-
"migrate": "MIGRATE=true bun script/migrate",
|
|
29
30
|
"patch": "npm version patch && git push && npm publish",
|
|
30
31
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
31
32
|
"test": "npx vitest run",
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@types/better-sqlite3": "^7.6.13",
|
|
72
|
-
"@types/bun": "^1.
|
|
73
|
+
"@types/bun": "^1.3.5",
|
|
73
74
|
"@types/js-yaml": "^4.0.9",
|
|
74
75
|
"@types/markdown-it": "^14.1.2",
|
|
75
76
|
"@types/node": "^24.3.1",
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"finishUpload.d.ts","sourceRoot":"","sources":["../../../../server/plugins/upload/finishUpload.ts"],"names":[],"mappings":"AAMA,wBAA8B,YAAY,CAAC,EACzC,IAAI,EACJ,EAAE,GACH,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,OAAO,CAAC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAqC/D"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
4
|
-
import { prefix, metaDir, fetchTimeoutMs } from "./index.js";
|
|
5
|
-
export default async function finishUpload({ host, id, }) {
|
|
6
|
-
if (!host) {
|
|
7
|
-
const metaExists = existsSync(path.join(metaDir, `${id}.json`));
|
|
8
|
-
if (!metaExists) {
|
|
9
|
-
return { error: "upload not found: " + id, code: 404 };
|
|
10
|
-
}
|
|
11
|
-
const meta = JSON.parse(await readFile(path.join(metaDir, `${id}.json`), "utf8"));
|
|
12
|
-
if (meta.uploaded !== meta.size) {
|
|
13
|
-
return { error: "Upload not complete", code: 400 };
|
|
14
|
-
}
|
|
15
|
-
const metaData = {
|
|
16
|
-
...meta,
|
|
17
|
-
uploadDate: new Date().toISOString(),
|
|
18
|
-
exists: true,
|
|
19
|
-
finished: true,
|
|
20
|
-
};
|
|
21
|
-
const fileBytes = Buffer.from(JSON.stringify(metaData, null, 2));
|
|
22
|
-
// save metadata
|
|
23
|
-
await writeFile(path.join(metaDir, `${id}.json`), fileBytes);
|
|
24
|
-
return { success: true, code: 200 };
|
|
25
|
-
}
|
|
26
|
-
const res = await fetch(`${host}/${prefix}/${id}/finish`, {
|
|
27
|
-
method: "POST",
|
|
28
|
-
signal: AbortSignal.timeout(fetchTimeoutMs),
|
|
29
|
-
}).catch((err) => ({
|
|
30
|
-
json: () => Promise.resolve({ error: err.toString(), code: 501 }),
|
|
31
|
-
}));
|
|
32
|
-
return res.json();
|
|
33
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routeOptions.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/util/funcs/routeOptions.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY,EAAE,GAAG,EAAO,CAAC;AAC/B,eAAe,YAAY,CAAC"}
|