@opengis/fastify-table 1.2.42 → 1.2.43

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/README.md +86 -86
  2. package/package.json +1 -1
  3. package/server/migrations/cls.sql +39 -39
  4. package/server/plugins/cron/funcs/addCron.js +130 -130
  5. package/server/plugins/cron/index.js +6 -6
  6. package/server/plugins/crud/funcs/dataDelete.js +7 -1
  7. package/server/plugins/crud/funcs/dataInsert.js +7 -0
  8. package/server/plugins/crud/funcs/dataUpdate.js +4 -1
  9. package/server/plugins/crud/funcs/getOpt.js +13 -13
  10. package/server/plugins/crud/funcs/setOpt.js +21 -21
  11. package/server/plugins/crud/funcs/setToken.js +44 -44
  12. package/server/plugins/crud/funcs/utils/getFolder.js +10 -10
  13. package/server/plugins/crud/index.js +23 -23
  14. package/server/plugins/extra/extraData.js +51 -28
  15. package/server/plugins/extra/extraDataGet.js +18 -4
  16. package/server/plugins/hook/index.js +8 -8
  17. package/server/plugins/logger/errorStatus.js +19 -19
  18. package/server/plugins/logger/index.js +21 -21
  19. package/server/plugins/migration/index.js +7 -7
  20. package/server/plugins/pg/pgClients.js +21 -21
  21. package/server/plugins/policy/sqlInjection.js +33 -33
  22. package/server/plugins/redis/client.js +8 -8
  23. package/server/plugins/redis/funcs/redisClients.js +3 -3
  24. package/server/plugins/redis/index.js +17 -17
  25. package/server/plugins/table/funcs/getFilterSQL/index.js +126 -96
  26. package/server/plugins/table/funcs/getFilterSQL/util/formatValue.js +37 -16
  27. package/server/plugins/table/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
  28. package/server/plugins/table/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
  29. package/server/plugins/table/funcs/getFilterSQL/util/getTableSql.js +34 -34
  30. package/server/plugins/table/funcs/getTemplates.js +19 -19
  31. package/server/plugins/table/funcs/gisIRColumn.js +82 -82
  32. package/server/plugins/table/funcs/loadTemplate.js +1 -1
  33. package/server/plugins/table/funcs/loadTemplatePath.js +1 -1
  34. package/server/plugins/table/funcs/metaFormat/index.js +3 -2
  35. package/server/plugins/table/funcs/userTemplateDir.js +1 -1
  36. package/server/plugins/table/index.js +13 -13
  37. package/server/plugins/util/index.js +7 -7
  38. package/server/routes/cron/index.js +14 -14
  39. package/server/routes/crud/controllers/table.js +88 -88
  40. package/server/routes/logger/controllers/logger.file.js +92 -92
  41. package/server/routes/logger/controllers/utils/checkUserAccess.js +19 -19
  42. package/server/routes/logger/controllers/utils/getRootDir.js +26 -26
  43. package/server/routes/logger/index.js +17 -17
  44. package/server/routes/properties/controllers/properties.add.js +55 -55
  45. package/server/routes/properties/controllers/properties.get.js +17 -17
  46. package/server/routes/properties/index.js +16 -16
  47. package/server/routes/table/controllers/data.js +12 -1
  48. package/server/routes/table/controllers/filter.js +3 -1
  49. package/server/routes/table/controllers/form.js +42 -42
  50. package/server/routes/table/controllers/search.js +74 -74
  51. package/server/routes/table/index.js +29 -29
  52. package/server/routes/table/schema.js +64 -64
  53. package/server/routes/util/controllers/status.monitor.js +8 -8
  54. package/server/routes/util/index.js +11 -11
@@ -1,64 +1,64 @@
1
- const tableSchema = {
2
- querystring: {
3
- limit: { type: 'string', pattern: '^(\\d+)$' },
4
- page: { type: 'string', pattern: '^(\\d+)$' },
5
- // filter: { type: 'string', pattern: '^([\\w\\d_-]+)=([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
6
- // search: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
7
- order: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
8
- desc: { type: 'string', pattern: '^(\\d+)$' },
9
- // state: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
10
- // custom: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
11
- bbox: { type: 'string', pattern: '^([\\d\\s,.-]+)$' },
12
- // polyline: { type: 'string', pattern: '^([\\d\\w\\|@\\/\\{\\}~_`]+)$' },
13
- key: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s_.-]+)$' },
14
- uid: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
15
- sql: { type: 'string', pattern: '^(\\d)$' },
16
- },
17
- params: {
18
- id: { type: 'string', pattern: '^([\\d\\w]+)$' },
19
- table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
20
- },
21
- };
22
-
23
- const searchSchema = {
24
- querystring: {
25
- page: { type: 'string', pattern: '^(\\d+)$' },
26
- limit: { type: 'string', pattern: '^(\\d+)$' },
27
- order: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
28
- desc: { type: 'string', pattern: '^(\\d+)$' },
29
- key: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s_.-]+)$' },
30
- table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
31
- sql: { type: 'string', pattern: '^(\\d)$' },
32
- },
33
- };
34
-
35
- const suggestSchema = {
36
- querystring: {
37
- lang: { type: 'string', pattern: '^([\\w]+)$' },
38
- parent: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
39
- sel: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
40
- name: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
41
- // key: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
42
- val: { type: 'string', pattern: '([\\d\\w]+)$' },
43
- sql: { type: 'string', pattern: '^(\\d)$' },
44
- },
45
- params: {
46
- // data: { type: 'string', pattern: '^([\\d\\w]+)$' },
47
- },
48
- };
49
-
50
- const formSchema = {
51
- params: {
52
- form: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
53
- },
54
- };
55
-
56
- const filterSchema = {
57
- params: {
58
- table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
59
- },
60
- };
61
-
62
- export {
63
- tableSchema, searchSchema, suggestSchema, formSchema, filterSchema,
64
- };
1
+ const tableSchema = {
2
+ querystring: {
3
+ limit: { type: 'string', pattern: '^(\\d+)$' },
4
+ page: { type: 'string', pattern: '^(\\d+)$' },
5
+ // filter: { type: 'string', pattern: '^([\\w\\d_-]+)=([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
6
+ // search: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
7
+ order: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
8
+ desc: { type: 'string', pattern: '^(\\d+)$' },
9
+ // state: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
10
+ // custom: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
11
+ bbox: { type: 'string', pattern: '^([\\d\\s,.-]+)$' },
12
+ // polyline: { type: 'string', pattern: '^([\\d\\w\\|@\\/\\{\\}~_`]+)$' },
13
+ key: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s_.-]+)$' },
14
+ uid: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
15
+ sql: { type: 'string', pattern: '^(\\d)$' },
16
+ },
17
+ params: {
18
+ id: { type: 'string', pattern: '^([\\d\\w]+)$' },
19
+ table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
20
+ },
21
+ };
22
+
23
+ const searchSchema = {
24
+ querystring: {
25
+ page: { type: 'string', pattern: '^(\\d+)$' },
26
+ limit: { type: 'string', pattern: '^(\\d+)$' },
27
+ order: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
28
+ desc: { type: 'string', pattern: '^(\\d+)$' },
29
+ key: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s_.-]+)$' },
30
+ table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
31
+ sql: { type: 'string', pattern: '^(\\d)$' },
32
+ },
33
+ };
34
+
35
+ const suggestSchema = {
36
+ querystring: {
37
+ lang: { type: 'string', pattern: '^([\\w]+)$' },
38
+ parent: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
39
+ sel: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
40
+ name: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
41
+ // key: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
42
+ val: { type: 'string', pattern: '([\\d\\w]+)$' },
43
+ sql: { type: 'string', pattern: '^(\\d)$' },
44
+ },
45
+ params: {
46
+ // data: { type: 'string', pattern: '^([\\d\\w]+)$' },
47
+ },
48
+ };
49
+
50
+ const formSchema = {
51
+ params: {
52
+ form: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
53
+ },
54
+ };
55
+
56
+ const filterSchema = {
57
+ params: {
58
+ table: { type: 'string', pattern: '^([\\d\\w_.-]+)$' },
59
+ },
60
+ };
61
+
62
+ export {
63
+ tableSchema, searchSchema, suggestSchema, formSchema, filterSchema,
64
+ };
@@ -1,8 +1,8 @@
1
- const formatMemoryUsage = (data) => `${Math.round(data / 1024 / 1024 * 100) / 100} MB`;
2
-
3
- export default async function statusMonitor() {
4
- const memoryUsage = process.memoryUsage();
5
- const message = Object.keys(memoryUsage)
6
- .reduce((acc, curr) => Object.assign(acc, { [curr]: formatMemoryUsage(memoryUsage[curr]) }), {});
7
- return { message, status: 200 };
8
- }
1
+ const formatMemoryUsage = (data) => `${Math.round(data / 1024 / 1024 * 100) / 100} MB`;
2
+
3
+ export default async function statusMonitor() {
4
+ const memoryUsage = process.memoryUsage();
5
+ const message = Object.keys(memoryUsage)
6
+ .reduce((acc, curr) => Object.assign(acc, { [curr]: formatMemoryUsage(memoryUsage[curr]) }), {});
7
+ return { message, status: 200 };
8
+ }
@@ -1,11 +1,11 @@
1
- import nextId from './controllers/next.id.js';
2
- import statusMonitor from './controllers/status.monitor.js';
3
-
4
- async function plugin(fastify, config = {}) {
5
- const prefix = config.prefix || '/api';
6
-
7
- fastify.get(`${prefix}/next-id`, {}, nextId);
8
- fastify.get(`${prefix}/status-monitor`, {}, statusMonitor);
9
- }
10
-
11
- export default plugin;
1
+ import nextId from './controllers/next.id.js';
2
+ import statusMonitor from './controllers/status.monitor.js';
3
+
4
+ async function plugin(fastify, config = {}) {
5
+ const prefix = config.prefix || '/api';
6
+
7
+ fastify.get(`${prefix}/next-id`, {}, nextId);
8
+ fastify.get(`${prefix}/status-monitor`, {}, statusMonitor);
9
+ }
10
+
11
+ export default plugin;