@opengis/fastify-table 2.4.10 → 2.4.12
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/config.d.ts.map +1 -1
- package/dist/config.js +6 -6
- package/dist/script/migrate.d.ts +1 -1
- package/dist/script/migrate.d.ts.map +1 -1
- package/dist/script/migrate.js +15 -23
- package/dist/script/migrate.ts +15 -33
- package/dist/server/migrations/users.sql +1 -1
- package/dist/server/plugins/grpc/grpc.d.ts.map +1 -1
- package/dist/server/plugins/grpc/grpc.js +11 -0
- package/dist/server/plugins/grpc/utils/convertp.proto +7 -0
- package/dist/server/plugins/migration/exec.migrations.all.d.ts +2 -0
- package/dist/server/plugins/migration/exec.migrations.all.d.ts.map +1 -0
- package/dist/server/plugins/migration/exec.migrations.all.js +65 -0
- package/dist/server/plugins/migration/exec.migrations.d.ts.map +1 -1
- package/dist/server/plugins/migration/exec.migrations.js +9 -2
- package/dist/server/plugins/migration/exec.sql.d.ts +1 -1
- package/dist/server/plugins/migration/exec.sql.d.ts.map +1 -1
- package/dist/server/plugins/migration/exec.sql.js +5 -7
- package/dist/server/routes/util/controllers/api.check.d.ts +2 -0
- package/dist/server/routes/util/controllers/api.check.d.ts.map +1 -0
- package/dist/server/routes/util/controllers/api.check.js +36 -0
- package/dist/server/routes/util/index.d.ts.map +1 -1
- package/dist/server/routes/util/index.js +2 -0
- package/dist/server.js +97 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -0
- package/package.json +4 -4
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,MAAM,KAA8D,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,MAAM,KAA8D,CAAC;AAiD3E,eAAe,MAAM,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -12,21 +12,21 @@ Object.assign(config, {
|
|
|
12
12
|
env: process.env.NODE_ENV,
|
|
13
13
|
port: config.port || process.env.PORT,
|
|
14
14
|
});
|
|
15
|
-
if (existsSync(`.env.local`)) {
|
|
16
|
-
dotenv.config({ path: `.env.local` }); // ! load .env.local
|
|
17
|
-
}
|
|
18
15
|
// example: bun server kamianske
|
|
19
16
|
if (process.cwd().split("\\").pop() &&
|
|
20
17
|
process.cwd().split("\\").pop() === "fastify-table" &&
|
|
21
18
|
process.argv[2] &&
|
|
22
19
|
existsSync(`.env.${process.argv[2]}`)) {
|
|
23
|
-
dotenv.config({ path: `.env.${process.argv[2]}
|
|
20
|
+
dotenv.config({ path: `.env.${process.argv[2]}`, override: true }); // ! for debug only
|
|
24
21
|
}
|
|
25
22
|
if (process.env?.NODE_ENV && existsSync(`.env.${process.env.NODE_ENV}`)) {
|
|
26
|
-
dotenv.config({ path: `.env.${process.env.NODE_ENV}
|
|
23
|
+
dotenv.config({ path: `.env.${process.env.NODE_ENV}`, override: true }); // ! load .env.{{production}} etc.
|
|
27
24
|
}
|
|
28
25
|
if (process.env?.NODE_ENV && existsSync(`.env.${process.env.NODE_ENV}.local`)) {
|
|
29
|
-
dotenv.config({ path: `.env.${process.env.NODE_ENV}.local
|
|
26
|
+
dotenv.config({ path: `.env.${process.env.NODE_ENV}.local`, override: true }); // ! load .env.{{production}}.local etc.
|
|
27
|
+
}
|
|
28
|
+
if (existsSync(`.env.local`)) {
|
|
29
|
+
dotenv.config({ path: `.env.local`, override: true }); // ! load .env.local
|
|
30
30
|
}
|
|
31
31
|
function loadEnvConfig() {
|
|
32
32
|
if (config.trace) {
|
package/dist/script/migrate.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function migrate(): void
|
|
1
|
+
export default function migrate(): Promise<void>;
|
|
2
2
|
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../script/migrate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../script/migrate.ts"],"names":[],"mappings":"AAaA,wBAA8B,OAAO,kBASpC"}
|
package/dist/script/migrate.js
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import config from "../config.js";
|
|
4
|
-
import plugin from "../index.js";
|
|
5
|
-
import execMigrations from "../server/plugins/migration/exec.migrations.js";
|
|
6
|
-
import pgClients from "../server/plugins/pg/pgClients.js";
|
|
7
|
-
const timeoutMs = +(config.migrationTimeout || 5000);
|
|
8
|
-
const port = process.env.PORT || config.port || 3000;
|
|
1
|
+
import getPGAsync from "../server/plugins/pg/funcs/getPGAsync.js";
|
|
2
|
+
import executeAllMigrations from "../server/plugins/migration/exec.migrations.all.js";
|
|
9
3
|
if (import.meta.main) {
|
|
10
4
|
migrate();
|
|
11
5
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (err) {
|
|
24
|
-
console.error("migrations error", err.toString());
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
6
|
+
function close(pg) {
|
|
7
|
+
if (pg && !pg.ending && !pg.ended) {
|
|
8
|
+
pg.end();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export default async function migrate() {
|
|
12
|
+
const pg = await getPGAsync();
|
|
13
|
+
await executeAllMigrations(pg).catch((err) => {
|
|
14
|
+
close(pg);
|
|
15
|
+
console.error("migrations error", err.toString());
|
|
16
|
+
process.exit(1);
|
|
27
17
|
});
|
|
18
|
+
close(pg);
|
|
19
|
+
process.exit(0);
|
|
28
20
|
}
|
package/dist/script/migrate.ts
CHANGED
|
@@ -1,41 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import config from "../config.js";
|
|
5
|
-
import plugin from "../index.js";
|
|
6
|
-
|
|
7
|
-
import execMigrations from "../server/plugins/migration/exec.migrations.js";
|
|
8
|
-
import pgClients from "../server/plugins/pg/pgClients.js";
|
|
9
|
-
|
|
10
|
-
const timeoutMs = +(config.migrationTimeout || 5000);
|
|
11
|
-
|
|
12
|
-
const port = process.env.PORT || config.port || 3000;
|
|
1
|
+
import getPGAsync from "../server/plugins/pg/funcs/getPGAsync.js";
|
|
2
|
+
import executeAllMigrations from "../server/plugins/migration/exec.migrations.all.js";
|
|
13
3
|
|
|
14
4
|
if (import.meta.main) {
|
|
15
5
|
migrate();
|
|
16
6
|
}
|
|
17
7
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
app.listen({ host: "0.0.0.0", port }, (err: any) => {
|
|
24
|
-
console.log(`Server started via port: ${port}`);
|
|
25
|
-
|
|
26
|
-
execMigrations(
|
|
27
|
-
path.join(process.cwd(), "server/migrations"),
|
|
28
|
-
pgClients.client
|
|
29
|
-
).catch((err) => console.error(err.toString()));
|
|
8
|
+
function close(pg: any) {
|
|
9
|
+
if (pg && !pg.ending && !pg.ended) {
|
|
10
|
+
pg.end();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
30
13
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
console.error("migrations error", err.toString());
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
14
|
+
export default async function migrate() {
|
|
15
|
+
const pg = await getPGAsync();
|
|
16
|
+
await executeAllMigrations(pg).catch((err) => {
|
|
17
|
+
close(pg);
|
|
18
|
+
console.error("migrations error", err.toString());
|
|
19
|
+
process.exit(1);
|
|
40
20
|
});
|
|
21
|
+
close(pg);
|
|
22
|
+
process.exit(0);
|
|
41
23
|
}
|
|
@@ -35,7 +35,7 @@ ALTER TABLE admin.users add CONSTRAINT admin_user_user_rnokpp UNIQUE (user_rnokp
|
|
|
35
35
|
|
|
36
36
|
-- update admin.users set user_type='regular' where user_type not in ('viewer', 'regular','admin','superadmin');
|
|
37
37
|
-- ALTER TABLE admin.users add constraint admin_user_type_check CHECK (user_type=any(array['viewer', 'regular','admin','superadmin']));
|
|
38
|
-
insert into admin.users (uid,login,user_name,email,sur_name,password,user_type,enabled)values('viewer','viewer','viewer','viewer','viewer','viewer','viewer', false) on conflict (uid) do update set enabled=excluded.enabled, sur_name=excluded.sur_name;
|
|
38
|
+
-- insert into admin.users (uid,login,user_name,email,sur_name,password,user_type,enabled)values('viewer','viewer','viewer','viewer','viewer','viewer','viewer', false) on conflict (uid) do update set enabled=excluded.enabled, sur_name=excluded.sur_name;
|
|
39
39
|
-- update admin.users set enabled=true where uid='viewer';
|
|
40
40
|
|
|
41
41
|
COMMENT ON TABLE admin.users IS 'Користувачі';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc.d.ts","sourceRoot":"","sources":["../../../../server/plugins/grpc/grpc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grpc.d.ts","sourceRoot":"","sources":["../../../../server/plugins/grpc/grpc.ts"],"names":[],"mappings":"AAyIA,QAAA,MAAM,OAAO,WAIX,CAAC;AAEH,eAAe,OAAO,CAAC"}
|
|
@@ -66,6 +66,16 @@ if (convertServerAddress) {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
+
const checkHealth = convertServerAddress
|
|
70
|
+
? () => new Promise((resolve, reject) => {
|
|
71
|
+
convertClient.healthCheck({}, (err) => {
|
|
72
|
+
if (err && err.message !== "12 UNIMPLEMENTED: Method not found!") {
|
|
73
|
+
return reject(err);
|
|
74
|
+
}
|
|
75
|
+
resolve({ status: "ok" });
|
|
76
|
+
});
|
|
77
|
+
})
|
|
78
|
+
: () => Promise.resolve();
|
|
69
79
|
const wrapGrpcCall = (methodName) => async (data) => new Promise((res, rej) => {
|
|
70
80
|
if (!convertServerAddress) {
|
|
71
81
|
logger.file("grpc/convert", {
|
|
@@ -98,6 +108,7 @@ const grpcMethods = methodNames.reduce((acc, name) => {
|
|
|
98
108
|
}, {});
|
|
99
109
|
const getGRPC = () => ({
|
|
100
110
|
...grpcMethods,
|
|
111
|
+
checkHealth,
|
|
101
112
|
convertServerAddress,
|
|
102
113
|
});
|
|
103
114
|
export default getGRPC;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
syntax = "proto3";
|
|
2
2
|
|
|
3
3
|
service Convert {
|
|
4
|
+
rpc HealthCheck (Empty) returns (HealthResponse);
|
|
4
5
|
rpc csvToXls(csvToXlsParams) returns (FileBase64) {}
|
|
5
6
|
rpc jsonToXls(jsonToXlsParams) returns (FileBase64) {}
|
|
6
7
|
rpc pdfMerge(pdfMergeParams) returns (FileBase64) {}
|
|
@@ -20,6 +21,12 @@ service Convert {
|
|
|
20
21
|
rpc geojsonToGpkg(geojsonToShpParams) returns (FileBase64) {}
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
message Empty {}
|
|
25
|
+
|
|
26
|
+
message HealthResponse {
|
|
27
|
+
string status = 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
message jsonToYamlIn {
|
|
24
31
|
string json = 1;
|
|
25
32
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.migrations.all.d.ts","sourceRoot":"","sources":["../../../../server/plugins/migration/exec.migrations.all.ts"],"names":[],"mappings":"AAyBA,wBAA8B,oBAAoB,CAAC,EAAE,MAAmB,mCA2DvE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { readdir } from "node:fs/promises";
|
|
4
|
+
import config from "../../../config.js";
|
|
5
|
+
import pgClients from "../pg/pgClients.js";
|
|
6
|
+
import execSql from "./exec.sql.js";
|
|
7
|
+
const time = Date.now();
|
|
8
|
+
const { debug = process.platform === "win32" } = config;
|
|
9
|
+
const sequence = (arr, fn) => {
|
|
10
|
+
return arr.reduce((promise, item) => promise.then(() => fn(item)), Promise.resolve());
|
|
11
|
+
};
|
|
12
|
+
async function executeAllSqls(dirpath, pg) {
|
|
13
|
+
if (!pg)
|
|
14
|
+
return;
|
|
15
|
+
const content = (await readdir(dirpath, { withFileTypes: true }))
|
|
16
|
+
.filter((el) => el.isFile() && path.extname(el.name) === ".sql")
|
|
17
|
+
.map((el) => el.name);
|
|
18
|
+
await content.reduce((promise, filename) => promise.then(() => execSql(path.join(dirpath, filename), pg, true)), Promise.resolve());
|
|
19
|
+
}
|
|
20
|
+
export default async function executeAllMigrations(pg = pgClients.client) {
|
|
21
|
+
if (!pg) {
|
|
22
|
+
const txt = "empty pg";
|
|
23
|
+
console.log(`⚠️ migrations skip: ${txt}`);
|
|
24
|
+
return txt;
|
|
25
|
+
}
|
|
26
|
+
const packages = existsSync("node_modules/@opengis")
|
|
27
|
+
? await readdir("node_modules/@opengis")
|
|
28
|
+
: [];
|
|
29
|
+
await sequence(packages, async (packageName) => {
|
|
30
|
+
const packageMigrationsDir = [
|
|
31
|
+
`node_modules/@opengis/${packageName}/server/migrations`,
|
|
32
|
+
`node_modules/@opengis/${packageName}/dist/server/migrations`,
|
|
33
|
+
].find((el) => existsSync(el));
|
|
34
|
+
if (!packageMigrationsDir) {
|
|
35
|
+
const txt = `no migrations found for package: ${packageName}`;
|
|
36
|
+
if (debug)
|
|
37
|
+
console.log(`⚠️ migrations skip: ${txt}`);
|
|
38
|
+
return txt;
|
|
39
|
+
}
|
|
40
|
+
await executeAllSqls(packageMigrationsDir, pg)
|
|
41
|
+
.then(() => {
|
|
42
|
+
if (debug) {
|
|
43
|
+
console.log(`migrations done: "${packageName}" package`, Date.now() - time);
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
.catch((err) => {
|
|
47
|
+
console.error(`migrations error: "${packageName}" package`, err.toString(), Date.now() - time);
|
|
48
|
+
throw err;
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
if (existsSync("server/migrations")) {
|
|
52
|
+
await executeAllSqls("server/migrations", pg)
|
|
53
|
+
.then(() => {
|
|
54
|
+
if (debug) {
|
|
55
|
+
console.log(`migrations done: current project`, Date.now() - time);
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
.catch((err) => {
|
|
59
|
+
console.error("migrations error: current project", err.toString(), Date.now() - time);
|
|
60
|
+
throw err;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
console.log("all migrations completed successfully", packages.length, Date.now() - time);
|
|
64
|
+
return "success";
|
|
65
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.migrations.d.ts","sourceRoot":"","sources":["../../../../server/plugins/migration/exec.migrations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exec.migrations.d.ts","sourceRoot":"","sources":["../../../../server/plugins/migration/exec.migrations.ts"],"names":[],"mappings":"AAYA,wBAA8B,cAAc,CAC1C,OAAO,EAAE,GAAG,EACZ,EAAE,MAAmB,EACrB,MAAM,UAAQ,mBAsEf"}
|
|
@@ -6,6 +6,7 @@ import execSql from "./exec.sql.js";
|
|
|
6
6
|
import pgClients from "../pg/pgClients.js";
|
|
7
7
|
const time = Date.now();
|
|
8
8
|
const debug = config.debug || config.local;
|
|
9
|
+
const nocache = config.disableCache || process.env.MIGRATE;
|
|
9
10
|
export default async function execMigrations(dirPath, pg = pgClients.client, iscore = false) {
|
|
10
11
|
if (!dirPath) {
|
|
11
12
|
const txt = "migrations skip: path not specified";
|
|
@@ -25,8 +26,14 @@ export default async function execMigrations(dirPath, pg = pgClients.client, isc
|
|
|
25
26
|
console.warn(`⚠️ ${txt}`);
|
|
26
27
|
return txt;
|
|
27
28
|
}
|
|
29
|
+
if (config.migrationsMode === "script") {
|
|
30
|
+
const txt = `migrations skip: not called via script`;
|
|
31
|
+
if (debug)
|
|
32
|
+
console.warn(`⚠️ ${txt}`);
|
|
33
|
+
return txt;
|
|
34
|
+
}
|
|
28
35
|
if (process.env.NODE_ENV !== "production" &&
|
|
29
|
-
!
|
|
36
|
+
!nocache &&
|
|
30
37
|
!(iscore ? config.migrationsCore : config.migrations)) {
|
|
31
38
|
const txt = `migrations skip: not a production environment - ${iscore ? "core" : "path"} : ${dirPath}`;
|
|
32
39
|
if (debug)
|
|
@@ -53,7 +60,7 @@ export default async function execMigrations(dirPath, pg = pgClients.client, isc
|
|
|
53
60
|
console.warn(`⚠️ ${txt}`);
|
|
54
61
|
return txt;
|
|
55
62
|
}
|
|
56
|
-
await content.reduce((promise, filename) => promise.then(() => execSql(path.join(dirPath, filename), pg)), Promise.resolve());
|
|
63
|
+
await content.reduce((promise, filename) => promise.then(() => execSql(path.join(dirPath, filename), pg, nocache)), Promise.resolve());
|
|
57
64
|
if (debug)
|
|
58
65
|
console.log("migrations success", dirPath, exists, Date.now() - time);
|
|
59
66
|
return "success";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function execSql(filepath: any, pg?: any): Promise<any>;
|
|
1
|
+
export default function execSql(filepath: any, pg?: any, nocache?: boolean): Promise<any>;
|
|
2
2
|
//# sourceMappingURL=exec.sql.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.sql.d.ts","sourceRoot":"","sources":["../../../../server/plugins/migration/exec.sql.ts"],"names":[],"mappings":"AAcA,wBAA8B,OAAO,
|
|
1
|
+
{"version":3,"file":"exec.sql.d.ts","sourceRoot":"","sources":["../../../../server/plugins/migration/exec.sql.ts"],"names":[],"mappings":"AAcA,wBAA8B,OAAO,CACnC,QAAQ,EAAE,GAAG,EACb,EAAE,MAAmB,EACrB,OAAO,GAAE,OAAe,gBAsDzB"}
|
|
@@ -8,7 +8,7 @@ import logger from "../logger/getLogger.js";
|
|
|
8
8
|
import getRedis from "../redis/funcs/getRedis.js";
|
|
9
9
|
const rclient = getRedis();
|
|
10
10
|
const debug = config.debug || config.local;
|
|
11
|
-
export default async function execSql(filepath, pg = pgClients.client) {
|
|
11
|
+
export default async function execSql(filepath, pg = pgClients.client, nocache = false) {
|
|
12
12
|
const start = Date.now();
|
|
13
13
|
if (!pg || !filepath)
|
|
14
14
|
return null;
|
|
@@ -28,18 +28,16 @@ export default async function execSql(filepath, pg = pgClients.client) {
|
|
|
28
28
|
.hgetall(`${pg?.options?.database}:migration-hashes`)
|
|
29
29
|
.then((obj) => Object.keys(obj))
|
|
30
30
|
: [];
|
|
31
|
-
if (hashes.includes(hash) &&
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
debug) {
|
|
35
|
-
console.log(filename, "skip equal hash", Date.now() - start);
|
|
31
|
+
if (hashes.includes(hash) && !nocache) {
|
|
32
|
+
if (debug)
|
|
33
|
+
console.log(filename, "skip equal hash", Date.now() - start);
|
|
36
34
|
return null;
|
|
37
35
|
}
|
|
38
36
|
try {
|
|
39
37
|
if (debug)
|
|
40
38
|
console.log(filename, "start", Date.now() - start);
|
|
41
39
|
await pg.query(sql);
|
|
42
|
-
if (!
|
|
40
|
+
if (!nocache && config.redis)
|
|
43
41
|
await rclient.hset(`${pg?.options?.database}:migration-hashes`, hash, 1);
|
|
44
42
|
if (debug)
|
|
45
43
|
console.log(filename, "finish", Date.now() - start);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.check.d.ts","sourceRoot":"","sources":["../../../../../server/routes/util/controllers/api.check.ts"],"names":[],"mappings":"AAqCA,wBAA8B,QAAQ,iBAkBrC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { HeadBucketCommand } from "@aws-sdk/client-s3";
|
|
2
|
+
import config from "../../../../config.js";
|
|
3
|
+
import grpc from "../../../plugins/grpc/grpc.js";
|
|
4
|
+
import pgClients from "../../../plugins/pg/pgClients.js";
|
|
5
|
+
import getRedis from "../../../plugins/redis/funcs/getRedis.js";
|
|
6
|
+
import s3Client from "../../../plugins/file/providers/s3/client.js";
|
|
7
|
+
import { applyHook } from "../../../../utils.js";
|
|
8
|
+
const timeoutPromise = async (name, promise) => {
|
|
9
|
+
if (!promise) {
|
|
10
|
+
return Promise.resolve({ [name]: "not configured" });
|
|
11
|
+
}
|
|
12
|
+
return Promise.race([
|
|
13
|
+
promise.then(() => ({ [name]: "ok" })).catch(() => ({ [name]: "error" })),
|
|
14
|
+
new Promise((resolve) => setTimeout(() => resolve({ [name]: "timeout" }), timeoutMs)),
|
|
15
|
+
]);
|
|
16
|
+
};
|
|
17
|
+
const { checkHealth, convertServerAddress } = grpc();
|
|
18
|
+
const redisClient = getRedis();
|
|
19
|
+
const timeoutMs = 300;
|
|
20
|
+
const bucketParams = new HeadBucketCommand({
|
|
21
|
+
Bucket: config.s3?.containerName || "work",
|
|
22
|
+
});
|
|
23
|
+
/*addHook("afterApiCheck", async (result: Record<string, string>) => {
|
|
24
|
+
return { ...result, mapnik: "not configured" };
|
|
25
|
+
});*/
|
|
26
|
+
export default async function apiCheck() {
|
|
27
|
+
const timeStart = Date.now();
|
|
28
|
+
const res = await Promise.all([
|
|
29
|
+
timeoutPromise("redis", redisClient ? redisClient.ping() : undefined),
|
|
30
|
+
timeoutPromise("pg", pgClients.client ? pgClients.client.query("select 1") : undefined),
|
|
31
|
+
timeoutPromise("convert", convertServerAddress ? checkHealth() : undefined),
|
|
32
|
+
timeoutPromise("s3", s3Client ? s3Client.send(bucketParams) : undefined),
|
|
33
|
+
]).then((result) => result.reduce((acc, curr) => ({ ...acc, ...curr }), {}));
|
|
34
|
+
const hootData = await applyHook("afterApiCheck", res);
|
|
35
|
+
return { time: Date.now() - timeStart, ...res, ...(hootData || {}) };
|
|
36
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/util/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/util/index.ts"],"names":[],"mappings":"AAYA,iBAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QAoCtC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -4,9 +4,11 @@ import statusMonitor from "./controllers/status.monitor.js";
|
|
|
4
4
|
import userTokens from "./controllers/user.tokens.js";
|
|
5
5
|
import codeGenerator from "./controllers/code.generator.js";
|
|
6
6
|
import dependencies from "./controllers/dependencies.js";
|
|
7
|
+
import apiCheck from "./controllers/api.check.js";
|
|
7
8
|
const tags = ["core", "util"];
|
|
8
9
|
function plugin(app, opt = {}) {
|
|
9
10
|
app.get("/next-id", { config: { tags, policy: "L0" } }, nextId);
|
|
11
|
+
app.get("/check", { config: { tags, role: "admin" } }, apiCheck);
|
|
10
12
|
app.get("/status-monitor", { config: { tags, role: "admin" } }, statusMonitor);
|
|
11
13
|
app.get("/user-tokens/:token", { config: { tags, role: "admin|regular" } }, userTokens);
|
|
12
14
|
app.get("/code-gen/:token/:column/:id?", { config: { tags, role: "admin|regular" } }, codeGenerator);
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* eslint-disable no-return-assign */
|
|
2
|
+
// This file contains code that we reuse
|
|
3
|
+
// between our tests.
|
|
4
|
+
import Fastify from 'fastify';
|
|
5
|
+
|
|
6
|
+
import config from './config.js';
|
|
7
|
+
import plugin from './index.js';
|
|
8
|
+
import loginEuSign from './server/routes/auth/controllers/page/loginEuSign.js';
|
|
9
|
+
|
|
10
|
+
import loggerTest from './server/routes/logger/controllers/logger.test.api.js';
|
|
11
|
+
import { addHook, logger, addTemplateDir, pgClients } from './utils.js';
|
|
12
|
+
import { BadRequestError } from './errors.js';
|
|
13
|
+
|
|
14
|
+
addHook('afterChunkedUpload', async ({ id, meta }) => {
|
|
15
|
+
console.log('chunked upload finished', id, meta);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const cwd = process.cwd();
|
|
19
|
+
|
|
20
|
+
const app = Fastify({ loggerInstance: logger });
|
|
21
|
+
function contentParser(req, body, done) {
|
|
22
|
+
const parseBody = decodeURIComponent(body.toString()).split('&').reduce((acc, el) => {
|
|
23
|
+
const [key, val] = el.split('=');
|
|
24
|
+
return { ...acc, [key]: val };
|
|
25
|
+
}, {});
|
|
26
|
+
done(null, parseBody);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
app.addContentTypeParser('application/x-www-form-urlencoded', { parseAs: 'buffer' }, contentParser);
|
|
30
|
+
|
|
31
|
+
await app.register(plugin, config);
|
|
32
|
+
|
|
33
|
+
// debug only
|
|
34
|
+
app.get('/login1', { config: { policy: 'L0' } }, loginEuSign);
|
|
35
|
+
addHook("afterAuth", async () => {
|
|
36
|
+
if (config.auth?.redirectAfter) return; // let config decide
|
|
37
|
+
return { href: "/user" }; // force redirect to specific page after login
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
addTemplateDir(`${cwd}/module/test`);
|
|
41
|
+
|
|
42
|
+
app.get('/logger-test', { config: { policy: 'L0' } }, loggerTest);
|
|
43
|
+
app.get('/err', { config: { policy: 'L0' } }, ({ query }) => {
|
|
44
|
+
if (query.custom) {
|
|
45
|
+
throw BadRequestError('this is message');
|
|
46
|
+
}
|
|
47
|
+
if (query.custom1) {
|
|
48
|
+
throw new BadRequestError('this is stil same message');
|
|
49
|
+
}
|
|
50
|
+
throw new Error('test error code 500');
|
|
51
|
+
});
|
|
52
|
+
app.get('/test-permissions', { config: { permission: 'orders.read' } }, async () => {
|
|
53
|
+
return 'allowed';
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
app.get('/health', {
|
|
57
|
+
// preHandler: userJwt,
|
|
58
|
+
config: {
|
|
59
|
+
tags: ['server.js'],
|
|
60
|
+
policy: 'L1', // L0, L1, L2
|
|
61
|
+
auth: 'user-jwt', // none, user-jwt, creds
|
|
62
|
+
role: 'admin', // role
|
|
63
|
+
scope: 'logger', // logger, admin, gis, bi
|
|
64
|
+
rateLimit: { max: 100, timeWindow: '1 minute', hook: 'preHandler' },
|
|
65
|
+
cors: { origins: ['https://app.example.com'] },
|
|
66
|
+
rbac: { resource: 'id', action: 'add' },
|
|
67
|
+
}
|
|
68
|
+
}, async () => {
|
|
69
|
+
const clients = await Promise.all(Object.keys(pgClients || {}).map(async key => {
|
|
70
|
+
const connected = await pgClients[key]?.query('select 1').catch(err => { err }).then(el => el?.rowCount);
|
|
71
|
+
const keys = Object.keys(pgClients[key] || {});
|
|
72
|
+
return {
|
|
73
|
+
name: key,
|
|
74
|
+
init: !!pgClients[key]?.tlist
|
|
75
|
+
&& !!pgClients[key]?.pk
|
|
76
|
+
&& !!pgClients[key]?.pgType
|
|
77
|
+
&& !!pgClients[key]?.relkinds
|
|
78
|
+
&& !!pgClients[key]?.queryCache,
|
|
79
|
+
connected: !!connected,
|
|
80
|
+
keys,
|
|
81
|
+
};
|
|
82
|
+
}));
|
|
83
|
+
return { ok: true, pgClients: clients };
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/* addCron(async function testCron() {
|
|
87
|
+
return (config.local || true) ? null : { message: 'Done', status: 200 };
|
|
88
|
+
}, 60 * 1); */
|
|
89
|
+
|
|
90
|
+
app.listen({ host: config.host || '0.0.0.0', port: config.port || process.env.PORT || 3000 }, (err) => {
|
|
91
|
+
console.log(`Server started via port: ${config.port || process.env.PORT || 3000}`);
|
|
92
|
+
if (err) {
|
|
93
|
+
console.error(err.toString());
|
|
94
|
+
logger.error(err);
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
});
|
package/dist/utils.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export { default as addHook } from "./server/plugins/hook/addHook.js";
|
|
|
48
48
|
export { default as applyHook } from "./server/plugins/hook/applyHook.js";
|
|
49
49
|
export { default as applyHookSync } from "./server/plugins/hook/applyHookSync.js";
|
|
50
50
|
export { default as execMigrations } from "./server/plugins/migration/exec.migrations.js";
|
|
51
|
+
export { default as executeAllMigrations } from "./server/plugins/migration/exec.migrations.all.js";
|
|
51
52
|
export { default as execSql } from "./server/plugins/migration/exec.sql.js";
|
|
52
53
|
export { default as addCron } from "./server/plugins/cron/funcs/addCron.js";
|
|
53
54
|
export { default as logger } from "./server/plugins/logger/getLogger.js";
|
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,eAA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@ -59,6 +59,7 @@ export { default as addHook } from "./server/plugins/hook/addHook.js";
|
|
|
59
59
|
export { default as applyHook } from "./server/plugins/hook/applyHook.js";
|
|
60
60
|
export { default as applyHookSync } from "./server/plugins/hook/applyHookSync.js";
|
|
61
61
|
export { default as execMigrations } from "./server/plugins/migration/exec.migrations.js";
|
|
62
|
+
export { default as executeAllMigrations } from "./server/plugins/migration/exec.migrations.all.js";
|
|
62
63
|
export { default as execSql } from "./server/plugins/migration/exec.sql.js";
|
|
63
64
|
// cron
|
|
64
65
|
export { default as addCron } from "./server/plugins/cron/funcs/addCron.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengis/fastify-table",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "core-plugins",
|
|
6
6
|
"keywords": [
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"dump": "bun ./script/dump.ts",
|
|
27
|
-
"migrate": "
|
|
27
|
+
"migrate": "bun ./script/migrate.ts",
|
|
28
28
|
"dump1": "bun ./dist/script/dump.js",
|
|
29
|
-
"migrate1": "
|
|
29
|
+
"migrate1": "bun ./dist/script/migrate.js",
|
|
30
30
|
"prepublishOnly": "npm run build",
|
|
31
31
|
"clean": "tsc -b --clean",
|
|
32
32
|
"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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"test": "npx vitest run",
|
|
39
39
|
"compress": "node compress.js",
|
|
40
40
|
"dev1": "bun --hot dist/server",
|
|
41
|
-
"dev": "NODE_ENV=
|
|
41
|
+
"dev": "NODE_ENV=development bun start",
|
|
42
42
|
"start": "LOG_LEVEL=trace bun server"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|