@opengis/fastify-table 2.0.112 → 2.0.114

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 (54) 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 +111 -130
  17. package/dist/script/dump.ts +213 -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/routes/table/functions/getData.js +1 -1
  34. package/dist/server/types/core.d.ts.map +1 -1
  35. package/dist/server/types/core.js +0 -1
  36. package/dist/test.setup.js +0 -1
  37. package/dist/utils.d.ts +2 -0
  38. package/dist/utils.d.ts.map +1 -1
  39. package/dist/utils.js +3 -0
  40. package/package.json +7 -4
  41. package/dist/log/migration/dist-geoname-cls.json +0 -1
  42. package/dist/log/migration/dist-geoname-cls.sql +0 -0
  43. package/dist/server/plugins/upload/finishUpload.d.ts +0 -9
  44. package/dist/server/plugins/upload/finishUpload.d.ts.map +0 -1
  45. package/dist/server/plugins/upload/finishUpload.js +0 -33
  46. package/dist/server/plugins/util/funcs/routeOptions.d.ts +0 -3
  47. package/dist/server/plugins/util/funcs/routeOptions.d.ts.map +0 -1
  48. package/dist/server/plugins/util/funcs/routeOptions.js +0 -2
  49. package/dist/server/routes/auth/controllers/2factor/generate.d.ts +0 -19
  50. package/dist/server/routes/auth/controllers/2factor/generate.d.ts.map +0 -1
  51. package/dist/server/routes/auth/controllers/2factor/generate.js +0 -38
  52. package/dist/server/routes/auth/controllers/2factor/toggle.d.ts +0 -18
  53. package/dist/server/routes/auth/controllers/2factor/toggle.d.ts.map +0 -1
  54. package/dist/server/routes/auth/controllers/2factor/toggle.js +0 -39
@@ -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
- }