@opengis/fastify-table 2.0.112 → 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.
Files changed (53) hide show
  1. package/dist/helper.d.ts +8 -0
  2. package/dist/helper.d.ts.map +1 -0
  3. package/dist/helper.js +34 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +6 -6
  6. package/dist/module/core/cls/constraint_action.json +10 -0
  7. package/dist/module/core/cls/constraint_matchtype.json +6 -0
  8. package/dist/module/core/cls/constraint_type.json +14 -0
  9. package/dist/module/core/cls/constraint_type_full.json +18 -0
  10. package/dist/module/core/cls/constraint_type_table.json +18 -0
  11. package/dist/module/core/cls/core.user_type.json +14 -0
  12. package/dist/module/core/pt/schemaItem.pt.hbs +18 -0
  13. package/dist/module/core/select/core.user_mentioned.sql +2 -0
  14. package/dist/script/dump.d.ts +2 -0
  15. package/dist/script/dump.d.ts.map +1 -0
  16. package/dist/script/dump.js +102 -129
  17. package/dist/script/dump.ts +205 -0
  18. package/dist/script/migrate.d.ts +2 -0
  19. package/dist/script/migrate.d.ts.map +1 -0
  20. package/dist/script/migrate.js +24 -25
  21. package/dist/script/migrate.ts +31 -0
  22. package/dist/server/plugins/sqlite/funcs/getSqlite.d.ts.map +1 -1
  23. package/dist/server/plugins/sqlite/funcs/getSqlite.js +1 -2
  24. package/dist/server/plugins/sqlite/sqliteClients.d.ts.map +1 -1
  25. package/dist/server/plugins/sqlite/sqliteClients.js +1 -2
  26. package/dist/server/plugins/table/funcs/getColumnCLS.d.ts.map +1 -1
  27. package/dist/server/plugins/table/funcs/getColumnCLS.js +18 -7
  28. package/dist/server/plugins/util/funcs/eventStream.d.ts +4 -1
  29. package/dist/server/plugins/util/funcs/eventStream.d.ts.map +1 -1
  30. package/dist/server/routes/table/controllers/dataInfo.d.ts +8 -1
  31. package/dist/server/routes/table/controllers/dataInfo.d.ts.map +1 -1
  32. package/dist/server/routes/table/controllers/dataInfo.js +7 -5
  33. package/dist/server/types/core.d.ts.map +1 -1
  34. package/dist/server/types/core.js +0 -1
  35. package/dist/test.setup.js +0 -1
  36. package/dist/utils.d.ts +2 -0
  37. package/dist/utils.d.ts.map +1 -1
  38. package/dist/utils.js +3 -0
  39. package/package.json +5 -4
  40. package/dist/log/migration/dist-geoname-cls.json +0 -1
  41. package/dist/log/migration/dist-geoname-cls.sql +0 -0
  42. package/dist/server/plugins/upload/finishUpload.d.ts +0 -9
  43. package/dist/server/plugins/upload/finishUpload.d.ts.map +0 -1
  44. package/dist/server/plugins/upload/finishUpload.js +0 -33
  45. package/dist/server/plugins/util/funcs/routeOptions.d.ts +0 -3
  46. package/dist/server/plugins/util/funcs/routeOptions.d.ts.map +0 -1
  47. package/dist/server/plugins/util/funcs/routeOptions.js +0 -2
  48. package/dist/server/routes/auth/controllers/2factor/generate.d.ts +0 -19
  49. package/dist/server/routes/auth/controllers/2factor/generate.d.ts.map +0 -1
  50. package/dist/server/routes/auth/controllers/2factor/generate.js +0 -38
  51. package/dist/server/routes/auth/controllers/2factor/toggle.d.ts +0 -18
  52. package/dist/server/routes/auth/controllers/2factor/toggle.d.ts.map +0 -1
  53. package/dist/server/routes/auth/controllers/2factor/toggle.js +0 -39
@@ -0,0 +1,2 @@
1
+ export default function migrate(): void;
2
+ //# sourceMappingURL=migrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../script/migrate.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,OAAO,SAiB9B"}
@@ -1,25 +1,24 @@
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
- process.env.PORT = process.env.PORT || config.port || 3000;
9
-
10
- const app = Fastify();
11
-
12
- app.register(plugin, config);
13
-
14
- app.listen({ host: '0.0.0.0', port: process.env.PORT }, (err) => {
15
- console.log(`Server started via port: ${process.env.PORT}`);
16
- setTimeout(() => {
17
- console.log('Server closed after timeout', timeoutMs);
18
- app.close();
19
- process.exit(0);
20
- }, timeoutMs);
21
- if (err) {
22
- console.error('migrations error', err.toString());
23
- process.exit(1);
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":"AAeA,iBAAS,cAAc,CAAC,EACtB,IAAI,EACJ,QAAgB,EAChB,aAAqB,EACrB,iBAAiB,EAAE,OAAe,GACnC,GAAE,GAAQ,OAqBV;AAED,eAAe,cAAc,CAAC"}
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
- ? // @ts-expect-error bun internal module
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":"AAeA,QAAA,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,CAAC;AAkB9C,eAAe,aAAa,CAAC"}
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
- ? // @ts-expect-error bun internal module
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":"AA2DA,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,OAOjE"}
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): (message?: any, ...optionalParams: any[]) => void;
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,qDA0B3C"}
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"}
@@ -8,5 +8,12 @@ export default function dataInfo({ pg, params, query, }: {
8
8
  query: {
9
9
  table?: string;
10
10
  };
11
- }, reply: FastifyReply): Promise<any>;
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":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAazD,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,gBA+DpB"}
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;AAUlB,MAAM,WAAW,UAAW,SAAQ,IAAI;IACtC,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC;CACjE;AAYD,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB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  let Database;
4
4
  if (execName === "bun") {
5
- // @ts-expect-error bun internal module
6
5
  const sqlite = await import("bun:sqlite");
7
6
  Database = sqlite.Database;
8
7
  }
@@ -1,5 +1,4 @@
1
1
  import { beforeEach, afterEach, afterAll } from "vitest";
2
- // @ts-expect-error required for unit tests only
3
2
  import { build, teardown } from "./helper.js";
4
3
  beforeEach(async () => {
5
4
  console.log("build after each bun test start...");
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
@@ -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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O,IAAI,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAE3F,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAE5F,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AAE9F,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAEnG,OAAO,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,UAAU,GACX,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,MAAM,IAAI,oBAAoB,EAC9B,OAAO,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.112",
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.2.21",
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,9 +0,0 @@
1
- export default function finishUpload({ host, id, }: {
2
- host?: string;
3
- id: string;
4
- }): Promise<{
5
- error?: string;
6
- success?: boolean;
7
- code: number;
8
- }>;
9
- //# sourceMappingURL=finishUpload.d.ts.map
@@ -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,3 +0,0 @@
1
- declare const routeOptions: any[];
2
- export default routeOptions;
3
- //# sourceMappingURL=routeOptions.d.ts.map
@@ -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"}
@@ -1,2 +0,0 @@
1
- const routeOptions = [];
2
- export default routeOptions;
@@ -1,19 +0,0 @@
1
- import { FastifyReply } from "fastify";
2
- import { ExtendedRequest } from "../../../../types/core.js";
3
- /**
4
- * Генерація secret для двохфакторної авторизації користувача
5
- *
6
- * @method GET
7
- * @summary Генерація user secret для двохфакторної авторизації
8
- * @priority 3
9
- * @alias generate
10
- * @type api
11
- * @tag auth
12
- * @requires 2fa
13
- * @errors 500
14
- * @returns {Number} status Номер помилки
15
- * @returns {String|Object} error Опис помилки
16
- * @returns {String|Object} message Повідомлення про успішне виконання або об'єкт з параметрами
17
- */
18
- export default function generateFunction({ pg, user }: ExtendedRequest, reply: FastifyReply): Promise<never>;
19
- //# sourceMappingURL=generate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/2factor/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAO5D;;;;;;;;;;;;;;GAcG;AAEH,wBAA8B,gBAAgB,CAC5C,EAAE,EAAqB,EAAE,IAAS,EAAE,EAAE,eAAe,EACrD,KAAK,EAAE,YAAY,kBAqBpB"}
@@ -1,38 +0,0 @@
1
- import config from "../../../../../config.js";
2
- import pgClients from "../../../../plugins/pg/pgClients.js";
3
- import { generate } from "./providers/totp.js";
4
- /**
5
- * Генерація secret для двохфакторної авторизації користувача
6
- *
7
- * @method GET
8
- * @summary Генерація user secret для двохфакторної авторизації
9
- * @priority 3
10
- * @alias generate
11
- * @type api
12
- * @tag auth
13
- * @requires 2fa
14
- * @errors 500
15
- * @returns {Number} status Номер помилки
16
- * @returns {String|Object} error Опис помилки
17
- * @returns {String|Object} message Повідомлення про успішне виконання або об'єкт з параметрами
18
- */
19
- export default async function generateFunction({ pg = pgClients.client, user = {} }, reply) {
20
- if (!user?.uid) {
21
- return reply.status(401).send("unauthorized");
22
- }
23
- const { uid } = user;
24
- if (!config?.auth?.["2factor"]) {
25
- return reply.status(400).send("2fa not enabled");
26
- }
27
- if (!config.pg) {
28
- return reply.status(400).send("empty pg");
29
- }
30
- if (!uid) {
31
- return reply.status(401).send("access restricted: unauthorized");
32
- }
33
- const res = await generate({ pg, uid });
34
- if (res?.enabled) {
35
- return reply.status(400).send("already created 2fa");
36
- }
37
- return reply.status(200).send(res);
38
- }
@@ -1,18 +0,0 @@
1
- import { FastifyReply } from 'fastify';
2
- /**
3
- * Включення/виключення двохфакторної авторизації для користувача
4
- *
5
- * @method GET
6
- * @summary Включення/виключення двохфакторної авторизації
7
- * @priority 2
8
- * @alias toggle
9
- * @type api
10
- * @tag auth
11
- * @requires 2fa
12
- * @errors 500
13
- * @returns {Number} status Номер помилки
14
- * @returns {String|Object} error Опис помилки
15
- * @returns {String|Object} message Повідомлення про успішне виконання або об'єкт з параметрами
16
- */
17
- export default function toggleFunction(req: any, reply: FastifyReply): Promise<never>;
18
- //# sourceMappingURL=toggle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/2factor/toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC;;;;;;;;;;;;;;GAcG;AAEH,wBAA8B,cAAc,CAAC,GAAG,EAAC,GAAG,EAAE,KAAK,EAAC,YAAY,kBAyBvE"}
@@ -1,39 +0,0 @@
1
- import config from '../../../../../config.js';
2
- import pgClients from '../../../../plugins/pg/pgClients.js';
3
- import { toggle } from './providers/totp.js';
4
- /**
5
- * Включення/виключення двохфакторної авторизації для користувача
6
- *
7
- * @method GET
8
- * @summary Включення/виключення двохфакторної авторизації
9
- * @priority 2
10
- * @alias toggle
11
- * @type api
12
- * @tag auth
13
- * @requires 2fa
14
- * @errors 500
15
- * @returns {Number} status Номер помилки
16
- * @returns {String|Object} error Опис помилки
17
- * @returns {String|Object} message Повідомлення про успішне виконання або об'єкт з параметрами
18
- */
19
- export default async function toggleFunction(req, reply) {
20
- const { pg = pgClients.client, session = {}, query = {}, } = req;
21
- const { uid } = session?.passport?.user || {};
22
- const { code, enable } = query;
23
- if (!config.pg) {
24
- return reply.status(400).send('empty pg');
25
- }
26
- if (!uid) {
27
- return reply.status(401).send('access restricted: unauthorized');
28
- }
29
- if (!code) {
30
- return reply.status(400).send('param "code" is required');
31
- }
32
- if (!Object.hasOwn(query, 'enable')) {
33
- return reply.status(400).send('param "enable" is required');
34
- }
35
- const data = await toggle({
36
- pg, code, enable: enable === 'true', uid,
37
- });
38
- return reply.status(200).send(data);
39
- }