@opengis/fastify-table 1.1.55 → 1.1.57

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 (260) hide show
  1. package/README.md +26 -26
  2. package/config.js +10 -10
  3. package/index.js +27 -14
  4. package/package.json +10 -6
  5. package/server/migrations/log.sql +80 -80
  6. package/{cron → server/plugins/cron}/funcs/addCron.js +15 -19
  7. package/server/plugins/cron/index.js +6 -0
  8. package/{crud → server/plugins/crud}/funcs/dataDelete.js +3 -1
  9. package/{crud → server/plugins/crud}/funcs/dataInsert.js +3 -0
  10. package/{crud → server/plugins/crud}/funcs/dataUpdate.js +3 -1
  11. package/{crud → server/plugins/crud}/funcs/getAccess.js +5 -3
  12. package/{crud → server/plugins/crud}/funcs/getOpt.js +2 -0
  13. package/{crud → server/plugins/crud}/funcs/getToken.js +30 -27
  14. package/{crud → server/plugins/crud}/funcs/isFileExists.js +13 -13
  15. package/{crud → server/plugins/crud}/funcs/setOpt.js +3 -0
  16. package/{crud → server/plugins/crud}/funcs/setToken.js +4 -1
  17. package/{crud → server/plugins/crud}/funcs/utils/getFolder.js +2 -1
  18. package/{crud → server/plugins/crud}/funcs/utils/logChanges.js +2 -2
  19. package/server/plugins/crud/index.js +23 -0
  20. package/{hook → server/plugins/hook}/funcs/addHook.js +1 -1
  21. package/{hook → server/plugins/hook}/funcs/applyHook.js +2 -2
  22. package/{cron/controllers/utils/cronList.js → server/plugins/hook/hookList.js} +1 -1
  23. package/server/plugins/hook/index.js +8 -0
  24. package/{logger → server/plugins/logger}/createFileStream.js +2 -2
  25. package/{logger → server/plugins/logger}/getLogger.js +1 -1
  26. package/{migration → server/plugins/migration/funcs}/exec.migrations.js +1 -1
  27. package/server/plugins/migration/index.js +7 -0
  28. package/{pg → server/plugins/pg}/funcs/getPG.js +3 -3
  29. package/{pg → server/plugins/pg}/funcs/getPGAsync.js +3 -3
  30. package/{pg → server/plugins/pg}/funcs/init.js +2 -4
  31. package/{pg → server/plugins/pg}/index.js +5 -14
  32. package/{pg → server/plugins/pg}/pgClients.js +2 -1
  33. package/{policy → server/plugins/policy}/funcs/checkPolicy.js +1 -1
  34. package/{crud/controllers/utils → server/plugins/policy/funcs}/checkXSS.js +1 -4
  35. package/{policy → server/plugins/policy}/index.js +0 -2
  36. package/{policy/funcs → server/plugins/policy}/sqlInjection.js +1 -1
  37. package/{crud/controllers/utils → server/plugins/policy}/xssInjection.js +72 -72
  38. package/{redis → server/plugins/redis}/funcs/getRedis.js +24 -23
  39. package/{redis → server/plugins/redis}/funcs/redisClients.js +1 -0
  40. package/{redis → server/plugins/redis}/index.js +2 -6
  41. package/{table → server/plugins/table}/funcs/getFilterSQL/index.js +3 -1
  42. package/{table/controllers/utils → server/plugins/table/funcs}/getSelectMeta.js +1 -10
  43. package/{table/controllers/utils → server/plugins/table/funcs}/getTemplate.js +2 -1
  44. package/{table/controllers/utils → server/plugins/table/funcs}/getTemplatePath.js +3 -3
  45. package/{table/controllers/utils → server/plugins/table/funcs}/getTemplates.js +2 -1
  46. package/{table/controllers/utils → server/plugins/table/funcs}/gisIRColumn.js +4 -7
  47. package/{table → server/plugins/table}/funcs/metaFormat/getSelectVal.js +4 -2
  48. package/{table → server/plugins/table}/funcs/metaFormat/index.js +3 -1
  49. package/server/plugins/table/index.js +13 -0
  50. package/{util → server/plugins/util/funcs}/eventStream.js +1 -0
  51. package/server/plugins/util/index.js +7 -0
  52. package/{cron → server/routes/cron}/controllers/cronApi.js +22 -22
  53. package/{cron → server/routes/cron}/index.js +5 -3
  54. package/{crud → server/routes/crud}/controllers/deleteCrud.js +2 -2
  55. package/{crud → server/routes/crud}/controllers/insert.js +5 -3
  56. package/{crud → server/routes/crud}/controllers/update.js +3 -3
  57. package/server/routes/crud/index.js +19 -0
  58. package/{util → server/routes/logger}/controllers/logger.file.js +5 -5
  59. package/{util → server/routes/logger}/controllers/utils/checkUserAccess.js +1 -1
  60. package/{util → server/routes/logger}/controllers/utils/getRootDir.js +4 -3
  61. package/server/routes/logger/index.js +15 -0
  62. package/{util → server/routes/properties}/controllers/properties.add.js +19 -20
  63. package/server/routes/properties/controllers/properties.get.js +17 -0
  64. package/{util → server/routes/properties}/index.js +5 -8
  65. package/{table → server/routes/table}/controllers/card.js +3 -5
  66. package/{table → server/routes/table}/controllers/data.js +4 -10
  67. package/{table → server/routes/table}/controllers/filter.js +3 -4
  68. package/{table → server/routes/table}/controllers/form.js +1 -1
  69. package/{table → server/routes/table}/controllers/search.js +15 -17
  70. package/{table → server/routes/table}/controllers/suggest.js +15 -10
  71. package/{table → server/routes/table}/controllers/table.js +5 -7
  72. package/{table → server/routes/table}/index.js +1 -10
  73. package/{table → server/routes/table}/schema.js +1 -1
  74. package/{util → server/routes/util}/controllers/next.id.js +4 -4
  75. package/server/routes/util/index.js +11 -0
  76. package/utils.js +58 -50
  77. package/.eslintrc.cjs +0 -44
  78. package/.gitlab-ci.yml +0 -18
  79. package/Changelog.md +0 -352
  80. package/cron/schema.js +0 -8
  81. package/crud/index.js +0 -31
  82. package/crud/schema.js +0 -11
  83. package/docs/.vitepress/abbr.mjs +0 -26
  84. package/docs/.vitepress/config.mjs +0 -127
  85. package/docs/.vitepress/navigation.mjs +0 -82
  86. package/docs/.vitepress/theme/Layout.vue +0 -17
  87. package/docs/.vitepress/theme/components/NavigationLinks.vue +0 -102
  88. package/docs/.vitepress/theme/components/Panzoom.vue +0 -169
  89. package/docs/.vitepress/theme/index.mjs +0 -15
  90. package/docs/.vitepress/theme/style.scss +0 -163
  91. package/docs/abbr.json +0 -4
  92. package/docs/api/cron/cronApi.md +0 -56
  93. package/docs/api/crud/deleteCrud.md +0 -58
  94. package/docs/api/crud/insert.md +0 -82
  95. package/docs/api/crud/update.md +0 -85
  96. package/docs/api/index.md +0 -47
  97. package/docs/api/notification/testEmail.md +0 -91
  98. package/docs/api/table/card.md +0 -73
  99. package/docs/api/table/data.md +0 -134
  100. package/docs/api/table/export.md +0 -60
  101. package/docs/api/table/filter.md +0 -104
  102. package/docs/api/table/form.md +0 -126
  103. package/docs/api/table/search.md +0 -123
  104. package/docs/api/table/suggest.md +0 -156
  105. package/docs/api/table/table.md +0 -107
  106. package/docs/api/user/user.cls.id.md +0 -77
  107. package/docs/api/user/user.cls.md +0 -49
  108. package/docs/api/user/user.cls.post.md +0 -62
  109. package/docs/api/user/user.info.md +0 -37
  110. package/docs/api/utils/logger.file.md +0 -61
  111. package/docs/api/utils/next.id.md +0 -34
  112. package/docs/api/utils/properties.add.md +0 -127
  113. package/docs/api/utils/properties.get.md +0 -73
  114. package/docs/api/utils/status.monitor.md +0 -36
  115. package/docs/api/widget/widget.del.md +0 -76
  116. package/docs/api/widget/widget.get.md +0 -233
  117. package/docs/api/widget/widget.set.md +0 -88
  118. package/docs/db/admin.md +0 -947
  119. package/docs/db/crm.md +0 -564
  120. package/docs/db/index.md +0 -9
  121. package/docs/db/log.md +0 -204
  122. package/docs/hook/card/afterCard.md +0 -20
  123. package/docs/hook/card/preCard.md +0 -25
  124. package/docs/hook/data/afterData.md +0 -26
  125. package/docs/hook/data/preData.md +0 -26
  126. package/docs/hook/deleteCrud/afterDelete.md +0 -21
  127. package/docs/hook/deleteCrud/preDelete.md +0 -26
  128. package/docs/hook/form/afterForm.md +0 -19
  129. package/docs/hook/form/preForm.md +0 -26
  130. package/docs/hook/getTemplate/afterTemplate.md +0 -24
  131. package/docs/hook/getTemplate/preTemplate.md +0 -29
  132. package/docs/hook/index.md +0 -45
  133. package/docs/hook/insert/afterInsert.md +0 -41
  134. package/docs/hook/insert/preInsert.md +0 -25
  135. package/docs/hook/table/afterTable.md +0 -20
  136. package/docs/hook/table/preTable.md +0 -25
  137. package/docs/hook/update/afterUpdate.md +0 -41
  138. package/docs/hook/update/preUpdate.md +0 -25
  139. package/docs/index.md +0 -42
  140. package/docs/public/fastify-dark.svg +0 -4
  141. package/docs/public/fastify.svg +0 -1
  142. package/docs/public/logo-short-dark.svg +0 -12
  143. package/docs/public/logo-short.svg +0 -11
  144. package/docs/public/logo.svg +0 -19
  145. package/docs/readme/index.md +0 -121
  146. package/docs/templates/card.md +0 -83
  147. package/docs/templates/cls.md +0 -29
  148. package/docs/templates/filters.md +0 -91
  149. package/docs/templates/forms.md +0 -139
  150. package/docs/templates/image.png +0 -0
  151. package/docs/templates/index.md +0 -28
  152. package/docs/templates/select.md +0 -90
  153. package/docs/templates/table.md +0 -162
  154. package/docs/utils/cron/addCron.md +0 -29
  155. package/docs/utils/crud/dataInsert.md +0 -52
  156. package/docs/utils/crud/dataUpdate.md +0 -53
  157. package/docs/utils/crud/getOpt.md +0 -34
  158. package/docs/utils/crud/isFileExists.md +0 -38
  159. package/docs/utils/crud/setOpt.md +0 -38
  160. package/docs/utils/hook/addHook.md +0 -74
  161. package/docs/utils/hook/applyHook.md +0 -64
  162. package/docs/utils/index.md +0 -48
  163. package/docs/utils/notification/addNotification.md +0 -28
  164. package/docs/utils/notification/notification.md +0 -41
  165. package/docs/utils/pg/autoIndex.md +0 -22
  166. package/docs/utils/pg/getMeta.md +0 -59
  167. package/docs/utils/pg/getPG.md +0 -34
  168. package/docs/utils/pg/init.md +0 -30
  169. package/docs/utils/pg/pg.md +0 -70
  170. package/docs/utils/redis/getRedis.md +0 -36
  171. package/docs/utils/redis/rclient.md +0 -74
  172. package/docs/utils/table/getForm.md +0 -69
  173. package/docs/utils/table/getMeta.md +0 -56
  174. package/docs/utils/table/getSelect.md +0 -39
  175. package/docs/utils/table/getSelectMeta.md +0 -47
  176. package/docs/utils/table/getTable.md +0 -78
  177. package/helper.js +0 -30
  178. package/module/core/select/core.user_mentioned.sql +0 -2
  179. package/module/test/cls/itree.composition.json +0 -26
  180. package/module/test/table/test.rest_zone.table.json +0 -266
  181. package/notification/controllers/readNotifications.js +0 -27
  182. package/notification/controllers/testEmail.js +0 -46
  183. package/notification/controllers/userNotifications.js +0 -61
  184. package/notification/controllers/utils/pin-m-ty-media-record-outline+303070.png +0 -0
  185. package/notification/funcs/addNotification.js +0 -21
  186. package/notification/funcs/sendNotification.js +0 -112
  187. package/notification/funcs/utils/sendEmail.js +0 -39
  188. package/notification/index.js +0 -18
  189. package/notification/schema.js +0 -10
  190. package/server.js +0 -26
  191. package/table/controllers/utils/getTemplate_old.js +0 -28
  192. package/test/api/applyHook.test.js +0 -95
  193. package/test/api/crud.test.js +0 -89
  194. package/test/api/crud.xss.test.js +0 -80
  195. package/test/api/notification.test.js +0 -48
  196. package/test/api/suggest.test.js +0 -66
  197. package/test/api/table.test.js +0 -134
  198. package/test/api/user.test.js +0 -85
  199. package/test/api/widget.test.js +0 -117
  200. package/test/config.example +0 -18
  201. package/test/funcs/pg.test.js +0 -34
  202. package/test/funcs/redis.test.js +0 -19
  203. package/test/helper/formatDate.test.js +0 -62
  204. package/test/templates/cls/itree.quality_condition.json +0 -20
  205. package/test/templates/cls/itree.recommend copy.json +0 -26
  206. package/test/templates/cls/itree.recommend.json +0 -26
  207. package/test/templates/cls/itree.type_plant.json +0 -65
  208. package/test/templates/cls/test.json +0 -10
  209. package/test/templates/form/cp_building.form.json +0 -33
  210. package/test/templates/select/account_id.json +0 -4
  211. package/test/templates/select/account_id.sql +0 -1
  212. package/test/templates/select/atu.nsdi.ato_level.json +0 -4
  213. package/test/templates/select/atu.nsdi.ato_level.sql +0 -11
  214. package/test/templates/select/contact_id.sql +0 -1
  215. package/test/templates/select/storage.data.json +0 -3
  216. package/test/templates/select/storage.data.sql +0 -1
  217. package/test/templates/select/test.storage.data.json +0 -4
  218. package/test/templates/select/test.storage.data.sql +0 -1
  219. package/test/templates/select/test.suggest.ato_new.json +0 -4
  220. package/test/templates/select/test.suggest.ato_new.sql +0 -26
  221. package/test/templates/select/test.suggest.data.json +0 -5
  222. package/test/templates/select/test.suggest.data.sql +0 -1
  223. package/test/templates/select/test.suggest.parent.sql +0 -2
  224. package/test/templates/table/gis.dataset.table.json +0 -21
  225. package/test/templates/table/green_space.table.json +0 -383
  226. package/test/templates/table/service.json +0 -18
  227. package/user/controllers/user.cls.id.js +0 -14
  228. package/user/controllers/user.cls.js +0 -71
  229. package/user/controllers/user.cls.post.js +0 -52
  230. package/user/controllers/user.info.js +0 -17
  231. package/user/index.js +0 -17
  232. package/user/schema.js +0 -17
  233. package/util/controllers/properties.get.js +0 -17
  234. package/util/schema.js +0 -19
  235. package/widget/controllers/utils/historyFormat.js +0 -76
  236. package/widget/controllers/utils/obj2db.js +0 -13
  237. package/widget/controllers/widget.del.js +0 -41
  238. package/widget/controllers/widget.get.js +0 -96
  239. package/widget/controllers/widget.set.js +0 -74
  240. package/widget/index.js +0 -40
  241. /package/{hook/funcs/hookList.js → server/plugins/cron/cronList.js} +0 -0
  242. /package/{logger → server/plugins/logger}/getHooks.js +0 -0
  243. /package/{logger → server/plugins/logger}/labels.js +0 -0
  244. /package/{logger → server/plugins/logger}/logger.test.api.js +0 -0
  245. /package/{logger → server/plugins/logger}/serializers.js +0 -0
  246. /package/{pg → server/plugins/pg}/funcs/autoIndex.js +0 -0
  247. /package/{pg → server/plugins/pg}/funcs/getMeta.js +0 -0
  248. /package/{pg → server/plugins/pg}/funcs/pgClients.js +0 -0
  249. /package/{redis → server/plugins/redis}/client.js +0 -0
  250. /package/{table/controllers/utils → server/plugins/table/funcs}/addTemplateDir.js +0 -0
  251. /package/{table → server/plugins/table}/funcs/getFilterSQL/util/formatValue.js +0 -0
  252. /package/{table → server/plugins/table}/funcs/getFilterSQL/util/getCustomQuery.js +0 -0
  253. /package/{table → server/plugins/table}/funcs/getFilterSQL/util/getFilterQuery.js +0 -0
  254. /package/{table → server/plugins/table}/funcs/getFilterSQL/util/getOptimizedQuery.js +0 -0
  255. /package/{table → server/plugins/table}/funcs/getFilterSQL/util/getTableSql.js +0 -0
  256. /package/{table/controllers/utils → server/plugins/table/funcs}/getSelect.js +0 -0
  257. /package/{table/controllers/utils → server/plugins/table/funcs}/loadTemplate.js +0 -0
  258. /package/{table/controllers/utils → server/plugins/table/funcs}/loadTemplatePath.js +0 -0
  259. /package/{table/controllers/utils → server/plugins/table/funcs}/userTemplateDir.js +0 -0
  260. /package/{util → server/routes/util}/controllers/status.monitor.js +0 -0
package/README.md CHANGED
@@ -1,26 +1,26 @@
1
- # fastify-table
2
-
3
- [![NPM version](https://img.shields.io/npm/v/@opengis/fastify-table)](https://www.npmjs.com/package/@opengis/fastify-table)
4
- [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
5
-
6
- It standardizes the entire form building process, while taking care of everything from rendering to validation and processing:
7
-
8
- - pg
9
- - redis
10
- - crud
11
-
12
- ## Install
13
-
14
- ```bash
15
- npm i @opengis/fastify-table
16
- ```
17
-
18
- ## Usage
19
-
20
- ```js
21
- fastify.register(import('@opengis/fastify-table'), config);
22
- ```
23
-
24
- ## Documenation
25
-
26
- For a detailed understanding fastify-table, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/gis.storage/).
1
+ # fastify-table
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@opengis/fastify-table)](https://www.npmjs.com/package/@opengis/fastify-table)
4
+ [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
5
+
6
+ It standardizes the entire form building process, while taking care of everything from rendering to validation and processing:
7
+
8
+ - pg
9
+ - redis
10
+ - crud
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm i @opengis/fastify-table
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```js
21
+ fastify.register(import('@opengis/fastify-table'), config);
22
+ ```
23
+
24
+ ## Documenation
25
+
26
+ For a detailed understanding fastify-table, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/gis.storage/).
package/config.js CHANGED
@@ -1,10 +1,10 @@
1
- import fs from 'fs';
2
-
3
- const fileName = ['config.json', '/data/local/config.json'].find(el => (fs.existsSync(el) ? el : null));
4
- const config = fileName ? JSON.parse(fs.readFileSync(fileName)) : {};
5
-
6
- Object.assign(config, {
7
- allTemplates: config?.allTemplates || {},
8
- });
9
-
10
- export default config;
1
+ import fs from 'fs';
2
+
3
+ const fileName = ['config.json', '/data/local/config.json'].find(el => (fs.existsSync(el) ? el : null));
4
+ const config = fileName ? JSON.parse(fs.readFileSync(fileName)) : {};
5
+
6
+ Object.assign(config, {
7
+ allTemplates: config?.allTemplates || {},
8
+ });
9
+
10
+ export default config;
package/index.js CHANGED
@@ -7,20 +7,27 @@ import fp from 'fastify-plugin';
7
7
  import config from './config.js';
8
8
  // import rclient from './redis/client.js';
9
9
 
10
- import redisPlugin from './redis/index.js';
11
- import pgPlugin from './pg/index.js';
12
- import tablePlugin from './table/index.js';
13
- import notificationPlugin from './notification/index.js';
14
- import widgetPlugin from './widget/index.js';
15
- import crudPlugin from './crud/index.js';
16
- import policyPlugin from './policy/index.js';
17
- import utilPlugin from './util/index.js';
18
- import cronPlugin from './cron/index.js';
19
- import userPlugin from './user/index.js';
10
+ // plugins
11
+ import cronPlugin from './server/plugins/cron/index.js';
12
+ import crudPlugin from './server/plugins/crud/index.js';
13
+ // hook, logger, migration - utils only
14
+ import pgPlugin from './server/plugins/pg/index.js';
15
+ import policyPlugin from './server/plugins/policy/index.js';
16
+ import redisPlugin from './server/plugins/redis/index.js';
17
+ import tablePlugin from './server/plugins/table/index.js';
18
+ import utilPlugin from './server/plugins/util/index.js';
19
+
20
+ // routes
21
+ import cronRoutes from './server/routes/cron/index.js';
22
+ import crudRoutes from './server/routes/crud/index.js';
23
+ import loggerRoutes from './server/routes/logger/index.js';
24
+ import propertiesRoutes from './server/routes/properties/index.js';
25
+ import tableRoutes from './server/routes/table/index.js';
26
+ import utilRoutes from './server/routes/util/index.js';
20
27
 
21
28
  // import pgClients from './pg/pgClients.js';
22
29
 
23
- import { addTemplateDir, execMigrations, logger } from './utils.js';
30
+ import { addTemplateDir, execMigrations } from './utils.js';
24
31
 
25
32
  async function plugin(fastify, opt) {
26
33
  // console.log(opt);
@@ -85,16 +92,22 @@ async function plugin(fastify, opt) {
85
92
  // fastify.decorateRequest('funcs', fastify);
86
93
  }
87
94
 
95
+ // plugins / utils / funcs
88
96
  policyPlugin(fastify);
89
97
  redisPlugin(fastify);
90
98
  await pgPlugin(fastify, opt);
91
99
  tablePlugin(fastify, opt);
92
100
  crudPlugin(fastify, opt);
93
- notificationPlugin(fastify, opt);
94
- widgetPlugin(fastify, opt);
95
101
  utilPlugin(fastify, opt);
96
102
  cronPlugin(fastify, opt);
97
- userPlugin(fastify, opt);
103
+
104
+ // routes / api
105
+ cronRoutes(fastify, opt);
106
+ crudRoutes(fastify, opt);
107
+ loggerRoutes(fastify, opt);
108
+ propertiesRoutes(fastify, opt);
109
+ tableRoutes(fastify, opt);
110
+ utilRoutes(fastify, opt);
98
111
 
99
112
  // core templates && cls
100
113
  const filename = fileURLToPath(import.meta.url);
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.1.55",
3
+ "version": "1.1.57",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "main": "index.js",
7
+ "files": [
8
+ "server/*",
9
+ "index.js",
10
+ "utils.js",
11
+ "config.js"
12
+ ],
7
13
  "scripts": {
8
14
  "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
9
15
  "test": "node --test",
@@ -14,15 +20,13 @@
14
20
  "dependencies": {
15
21
  "@fastify/sensible": "^5.0.0",
16
22
  "@fastify/url-data": "^5.4.0",
17
- "@opengis/fastify-hb": "^1.4.2",
18
- "@opengis/fastify-table": "^1.1.47",
23
+ "@opengis/fastify-hb": "^1.4.4",
19
24
  "fastify": "^4.26.1",
20
25
  "fastify-plugin": "^4.0.0",
21
26
  "ioredis": "^5.3.2",
22
27
  "nodemailer": "^6.5.0",
23
28
  "pg": "^8.11.3",
24
- "pino-abstract-transport": "^2.0.0",
25
- "rotating-file-stream": "^3.2.3"
29
+ "pino-abstract-transport": "^2.0.0"
26
30
  },
27
31
  "devDependencies": {
28
32
  "@panzoom/panzoom": "^4.5.1",
@@ -39,4 +43,4 @@
39
43
  },
40
44
  "author": "Softpro",
41
45
  "license": "ISC"
42
- }
46
+ }
@@ -1,81 +1,81 @@
1
- create schema if not exists log;
2
-
3
- -- DROP TABLE IF EXISTS log.table_changes cascade;
4
- CREATE TABLE IF NOT EXISTS log.table_changes();
5
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_id text NOT NULL DEFAULT next_id();
6
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_type text;
7
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_date date;
8
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_user_id text;
9
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
10
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
11
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS uid text;
12
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
13
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_id text;
14
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
15
-
16
- -- DROP TABLE IF EXISTS log.table_changes_data;
17
- CREATE TABLE IF NOT EXISTS log.table_changes_data();
18
- ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS change_data_id text NOT NULL DEFAULT next_id();
19
- ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS change_id text not null;
20
- ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS entity_key text; -- column_name
21
- ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS value_old text;
22
- ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS value_new text;
23
- ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS uid text;
24
- ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
25
- ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS editor_id text;
26
- ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
27
-
28
- -- DROP TABLE IF EXISTS log.user_auth;
29
- CREATE TABLE IF NOT EXISTS log.user_auth();
30
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_id text NOT NULL DEFAULT next_id();
31
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_id text;
32
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS auth_date timestamp without time zone;
33
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS auth_type text;
34
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS uid text;
35
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
36
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_id text;
37
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
38
-
39
- COMMENT ON TABLE log.table_changes IS 'Логи подій змін в БД';
40
- COMMENT ON COLUMN log.table_changes.change_type IS 'Тип події (insert / update / delete)';
41
- COMMENT ON COLUMN log.table_changes.change_date IS 'Дата внесення змін до БД';
42
- COMMENT ON COLUMN log.table_changes.entity_type IS 'Таблиця, до якої вносяться зміни';
43
- COMMENT ON COLUMN log.table_changes.entity_id IS 'ID строки, до якої вносяться зміни';
44
- COMMENT ON COLUMN log.table_changes.change_user_id IS 'Ініціатор внесення змін';
45
-
46
- COMMENT ON TABLE log.table_changes_data IS 'Логи змін в таблицях БД';
47
- COMMENT ON COLUMN log.table_changes_data.change_id IS 'ID події зміни в БД';
48
- COMMENT ON COLUMN log.table_changes_data.entity_key IS 'Колонка таблиці, до якої вносяться зміни';
49
- COMMENT ON COLUMN log.table_changes_data.value_old IS 'Старе значення';
50
- COMMENT ON COLUMN log.table_changes_data.value_new IS 'Нове значення';
51
-
52
- COMMENT ON TABLE log.user_auth IS 'Логи авторизації';
53
- COMMENT ON COLUMN log.user_auth.user_id IS 'ID користувача';
54
- COMMENT ON COLUMN log.user_auth.auth_date IS 'Дата авторизації';
55
- COMMENT ON COLUMN log.user_auth.auth_type IS 'Тип авторизації';
56
-
57
- ALTER TABLE log.table_changes DROP CONSTRAINT IF EXISTS log_table_changes_pkey cascade;
58
- ALTER TABLE log.table_changes_data DROP CONSTRAINT IF EXISTS log_table_changes_data_pkey;
59
- ALTER TABLE log.table_changes_data DROP CONSTRAINT IF EXISTS log_table_changes_data_change_id_fkey;
60
- ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_pkey;
61
- ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_user_id_fkey;
62
-
63
- ALTER TABLE log.table_changes ADD CONSTRAINT log_table_changes_pkey PRIMARY KEY (change_id);
64
- ALTER TABLE log.table_changes_data ADD CONSTRAINT log_table_changes_data_pkey PRIMARY KEY (change_data_id);
65
- ALTER TABLE log.table_changes_data ADD CONSTRAINT log_table_changes_data_change_id_fkey FOREIGN KEY (change_id)
66
- REFERENCES log.table_changes (change_id);
67
- ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_pkey PRIMARY KEY (user_auth_id);
68
- -- ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_user_id_fkey FOREIGN KEY (user_id) REFERENCES admin.users (uid) MATCH SIMPLE;
69
-
70
- /* drop old columns */
71
- alter table log.table_changes drop column if exists date_new;
72
- alter table log.table_changes drop column if exists date_old;
73
- alter table log.table_changes drop column if exists number_new;
74
- alter table log.table_changes drop column if exists number_old;
75
- alter table log.table_changes drop column if exists json_new;
76
- alter table log.table_changes drop column if exists json_old;
77
- alter table log.table_changes drop column if exists text_new;
78
- alter table log.table_changes drop column if exists text_old;
79
- alter table log.table_changes drop column if exists bool_new;
80
- alter table log.table_changes drop column if exists bool_old;
1
+ create schema if not exists log;
2
+
3
+ -- DROP TABLE IF EXISTS log.table_changes cascade;
4
+ CREATE TABLE IF NOT EXISTS log.table_changes();
5
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_id text NOT NULL DEFAULT next_id();
6
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_type text;
7
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_date date;
8
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_user_id text;
9
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
10
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
11
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS uid text;
12
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
13
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_id text;
14
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
15
+
16
+ -- DROP TABLE IF EXISTS log.table_changes_data;
17
+ CREATE TABLE IF NOT EXISTS log.table_changes_data();
18
+ ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS change_data_id text NOT NULL DEFAULT next_id();
19
+ ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS change_id text not null;
20
+ ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS entity_key text; -- column_name
21
+ ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS value_old text;
22
+ ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS value_new text;
23
+ ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS uid text;
24
+ ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
25
+ ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS editor_id text;
26
+ ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
27
+
28
+ -- DROP TABLE IF EXISTS log.user_auth;
29
+ CREATE TABLE IF NOT EXISTS log.user_auth();
30
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_id text NOT NULL DEFAULT next_id();
31
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_id text;
32
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS auth_date timestamp without time zone;
33
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS auth_type text;
34
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS uid text;
35
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
36
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_id text;
37
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
38
+
39
+ COMMENT ON TABLE log.table_changes IS 'Логи подій змін в БД';
40
+ COMMENT ON COLUMN log.table_changes.change_type IS 'Тип події (insert / update / delete)';
41
+ COMMENT ON COLUMN log.table_changes.change_date IS 'Дата внесення змін до БД';
42
+ COMMENT ON COLUMN log.table_changes.entity_type IS 'Таблиця, до якої вносяться зміни';
43
+ COMMENT ON COLUMN log.table_changes.entity_id IS 'ID строки, до якої вносяться зміни';
44
+ COMMENT ON COLUMN log.table_changes.change_user_id IS 'Ініціатор внесення змін';
45
+
46
+ COMMENT ON TABLE log.table_changes_data IS 'Логи змін в таблицях БД';
47
+ COMMENT ON COLUMN log.table_changes_data.change_id IS 'ID події зміни в БД';
48
+ COMMENT ON COLUMN log.table_changes_data.entity_key IS 'Колонка таблиці, до якої вносяться зміни';
49
+ COMMENT ON COLUMN log.table_changes_data.value_old IS 'Старе значення';
50
+ COMMENT ON COLUMN log.table_changes_data.value_new IS 'Нове значення';
51
+
52
+ COMMENT ON TABLE log.user_auth IS 'Логи авторизації';
53
+ COMMENT ON COLUMN log.user_auth.user_id IS 'ID користувача';
54
+ COMMENT ON COLUMN log.user_auth.auth_date IS 'Дата авторизації';
55
+ COMMENT ON COLUMN log.user_auth.auth_type IS 'Тип авторизації';
56
+
57
+ ALTER TABLE log.table_changes DROP CONSTRAINT IF EXISTS log_table_changes_pkey cascade;
58
+ ALTER TABLE log.table_changes_data DROP CONSTRAINT IF EXISTS log_table_changes_data_pkey;
59
+ ALTER TABLE log.table_changes_data DROP CONSTRAINT IF EXISTS log_table_changes_data_change_id_fkey;
60
+ ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_pkey;
61
+ ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_user_id_fkey;
62
+
63
+ ALTER TABLE log.table_changes ADD CONSTRAINT log_table_changes_pkey PRIMARY KEY (change_id);
64
+ ALTER TABLE log.table_changes_data ADD CONSTRAINT log_table_changes_data_pkey PRIMARY KEY (change_data_id);
65
+ ALTER TABLE log.table_changes_data ADD CONSTRAINT log_table_changes_data_change_id_fkey FOREIGN KEY (change_id)
66
+ REFERENCES log.table_changes (change_id);
67
+ ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_pkey PRIMARY KEY (user_auth_id);
68
+ -- ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_user_id_fkey FOREIGN KEY (user_id) REFERENCES admin.users (uid) MATCH SIMPLE;
69
+
70
+ /* drop old columns */
71
+ alter table log.table_changes drop column if exists date_new;
72
+ alter table log.table_changes drop column if exists date_old;
73
+ alter table log.table_changes drop column if exists number_new;
74
+ alter table log.table_changes drop column if exists number_old;
75
+ alter table log.table_changes drop column if exists json_new;
76
+ alter table log.table_changes drop column if exists json_old;
77
+ alter table log.table_changes drop column if exists text_new;
78
+ alter table log.table_changes drop column if exists text_old;
79
+ alter table log.table_changes drop column if exists bool_new;
80
+ alter table log.table_changes drop column if exists bool_old;
81
81
  alter table log.table_changes drop column if exists table_change_id;
@@ -1,9 +1,10 @@
1
1
  import { createHash } from 'crypto';
2
2
 
3
- import cronList from '../controllers/utils/cronList.js';
3
+ import config from '../../../../config.js';
4
4
  import getRedis from '../../redis/funcs/getRedis.js';
5
5
  import getPG from '../../pg/funcs/getPG.js';
6
- import config from '../../config.js';
6
+ import logger from '../../logger/getLogger.js';
7
+ import cronList from '../cronList.js';
7
8
 
8
9
  const md5 = (string) => createHash('md5').update(string).digest('hex');
9
10
 
@@ -58,21 +59,21 @@ const interval2ms = {
58
59
  };
59
60
 
60
61
  async function runCron({
61
- pg, funcs, func, name, rclient, log,
62
+ pg, func, name, rclient,
62
63
  }) {
63
64
  const unique = await verifyUnique(name, rclient);
64
65
 
65
66
  if (!unique) return;
66
67
  const db = pg.options.database;
67
- log.debug(`cron.${name}`, 1, db);
68
+ logger.debug(`cron.${name}`, 1, db);
68
69
  try {
69
- const data = await func({ pg, funcs, log });
70
- log.debug('cron', { db, name, result: data });
71
- log.info('cron', { db, name, result: data });
70
+ const data = await func({ pg });
71
+ logger.debug('cron', { db, name, result: data });
72
+ logger.info('cron', { db, name, result: data });
72
73
  }
73
74
  catch (err) {
74
- log.debug('cron', { db, name, error: err.toString() });
75
- log.error('cron', { db, name, error: err.toString() });
75
+ logger.debug('cron', { db, name, error: err.toString() });
76
+ logger.error('cron', { db, name, error: err.toString() });
76
77
  }
77
78
  }
78
79
 
@@ -88,12 +89,7 @@ async function runCron({
88
89
  * - 10 * 60 - every 10 minutes
89
90
  */
90
91
 
91
- export default async function addCron(func, interval, fastify) {
92
- if (!fastify) {
93
- throw new Error('not enough params: fastify');
94
- }
95
-
96
- const { log } = fastify;
92
+ export default async function addCron(func, interval) {
97
93
  const { time = {}, disabled = [] } = config.cron || {};
98
94
  const pg = getPG();
99
95
  const rclient = getRedis();
@@ -103,7 +99,7 @@ export default async function addCron(func, interval, fastify) {
103
99
  // if (!config.isServer) return;
104
100
 
105
101
  if (disabled.includes(name)) {
106
- log.debug('cron', { name, message: 'cron disabled' });
102
+ logger.debug('cron', { name, message: 'cron disabled' });
107
103
  return;
108
104
  }
109
105
 
@@ -113,19 +109,19 @@ export default async function addCron(func, interval, fastify) {
113
109
  const [waitMs, intervalMs] = interval2ms[typeof interval](userInterval);
114
110
 
115
111
  if (intervalMs < 1000) {
116
- log.warn('cron', { name, error: `interval ${interval} to small` });
112
+ logger.warn('cron', { name, error: `interval ${interval} to small` });
117
113
  return;
118
114
  }
119
115
 
120
116
  // setTimeout to w8 for the time to start
121
117
  setTimeout(() => {
122
118
  runCron({
123
- pg, funcs: fastify, func, name, rclient, log,
119
+ pg, func, name, rclient, logger,
124
120
  });
125
121
  // interval
126
122
  setInterval(() => {
127
123
  runCron({
128
- pg, funcs: fastify, func, name, rclient, log,
124
+ pg, func, name, rclient, logger,
129
125
  });
130
126
  }, intervalMs);
131
127
  }, waitMs);
@@ -0,0 +1,6 @@
1
+ import addCron from './funcs/addCron.js';
2
+
3
+ async function plugin(fastify) {
4
+ // fastify.decorate('addCron', addCron);
5
+ }
6
+ export default plugin;
@@ -1,6 +1,8 @@
1
1
  import getPG from '../../pg/funcs/getPG.js';
2
-
3
2
  import getMeta from '../../pg/funcs/getMeta.js';
3
+
4
+ // import { getPG, getMeta } from '../../../../utils.js';
5
+
4
6
  import logChanges from './utils/logChanges.js';
5
7
 
6
8
  export default async function dataDelete({
@@ -1,5 +1,8 @@
1
1
  import getPG from '../../pg/funcs/getPG.js';
2
2
  import getMeta from '../../pg/funcs/getMeta.js';
3
+
4
+ // import { getPG, getMeta } from '../../../../utils.js';
5
+
3
6
  import logChanges from './utils/logChanges.js';
4
7
 
5
8
  export default async function dataInsert({
@@ -1,6 +1,8 @@
1
1
  import getPG from '../../pg/funcs/getPG.js';
2
-
3
2
  import getMeta from '../../pg/funcs/getMeta.js';
3
+
4
+ // import { getPG, getMeta } from '../../../../utils.js';
5
+
4
6
  import logChanges from './utils/logChanges.js';
5
7
 
6
8
  const srids = {};
@@ -1,9 +1,11 @@
1
- // import getMeta from '../../pg/funcs/getMeta.js';
2
- import getTemplate from '../../table/controllers/utils/getTemplate.js';
3
- import config from '../../config.js';
1
+ import config from '../../../../config.js';
4
2
  import pgClients from '../../pg/pgClients.js';
3
+
4
+ import getTemplate from '../../table/funcs/getTemplate.js';
5
5
  import applyHook from '../../hook/funcs/applyHook.js';
6
6
 
7
+ // import { config, pgClients, getTemplate, applyHook } from '../../../../utils.js';
8
+
7
9
  const q = `select a.route_id as id, coalesce(b.actions,array['get']) as actions, b.scope
8
10
  from admin.routes a
9
11
  left join admin.access b on
@@ -1,5 +1,7 @@
1
1
  import getRedis from '../../redis/funcs/getRedis.js';
2
2
 
3
+ // import { getRedis } from '../../../../utils.js';
4
+
3
5
  export default async function getOpt(token, funcs) {
4
6
  const rclient = getRedis({ db: 0, funcs });
5
7
 
@@ -1,27 +1,30 @@
1
- import getRedis from '../../redis/funcs/getRedis.js';
2
- import config from '../../config.js';
3
-
4
- function sprintf(str, ...args) {
5
- return str.replace(/%s/g, () => args.shift());
6
- }
7
-
8
- const keys = {
9
- r: '%s:token:view:%s',
10
- a: '%s:token:add:%s',
11
- w: '%s:token:edit:%s',
12
- e: '%s:token:exec:%s',
13
- };
14
-
15
- async function getToken({
16
- uid, token, mode = 'r', json,
17
- }) {
18
- if (mode === 'r') return token;
19
-
20
- const rclient = getRedis({ db: 0 });
21
-
22
- const key = sprintf(keys[mode], config?.pg?.database, uid?.toString());
23
- const id = await rclient.hget(key, token);
24
- return json && id?.[0] === '{' ? JSON.parse(id) : id;
25
- }
26
-
27
- export default getToken;
1
+ import config from '../../../../config.js';
2
+
3
+ import getRedis from '../../redis/funcs/getRedis.js';
4
+
5
+ // import { config, getRedis } from '../../../../utils.js';
6
+
7
+ function sprintf(str, ...args) {
8
+ return str.replace(/%s/g, () => args.shift());
9
+ }
10
+
11
+ const keys = {
12
+ r: '%s:token:view:%s',
13
+ a: '%s:token:add:%s',
14
+ w: '%s:token:edit:%s',
15
+ e: '%s:token:exec:%s',
16
+ };
17
+
18
+ async function getToken({
19
+ uid, token, mode = 'r', json,
20
+ }) {
21
+ if (mode === 'r') return token;
22
+
23
+ const rclient = getRedis({ db: 0 });
24
+
25
+ const key = sprintf(keys[mode], config?.pg?.database, uid?.toString());
26
+ const id = await rclient.hget(key, token);
27
+ return json && id?.[0] === '{' ? JSON.parse(id) : id;
28
+ }
29
+
30
+ export default getToken;
@@ -1,13 +1,13 @@
1
- import { access } from 'fs/promises';
2
-
3
- const isFileExists = async (filepath) => {
4
- try {
5
- await access(filepath);
6
- return true;
7
- }
8
- catch (err) {
9
- return false;
10
- }
11
- };
12
-
13
- export default isFileExists;
1
+ import { access } from 'fs/promises';
2
+
3
+ const isFileExists = async (filepath) => {
4
+ try {
5
+ await access(filepath);
6
+ return true;
7
+ }
8
+ catch (err) {
9
+ return false;
10
+ }
11
+ };
12
+
13
+ export default isFileExists;
@@ -1,6 +1,9 @@
1
1
  import { createHash } from 'crypto';
2
+
2
3
  import getRedis from '../../redis/funcs/getRedis.js';
3
4
 
5
+ // import { getRedis } from '../../../../utils.js';
6
+
4
7
  function md5(string) {
5
8
  return createHash('md5').update(string).digest('hex');
6
9
  }
@@ -1,8 +1,11 @@
1
1
  import { createHash, randomUUID } from 'crypto';
2
2
 
3
- import config from '../../config.js';
3
+ import config from '../../../../config.js';
4
+
4
5
  import getRedis from '../../redis/funcs/getRedis.js';
5
6
 
7
+ // import { config, getRedis } from '../../../../utils.js';
8
+
6
9
  const generateCodes = (ids, userToken) => {
7
10
  const token = userToken || randomUUID();
8
11
  const notNullIds = ids.filter((el) => el);
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
- import config from '../../../config.js';
2
+
3
+ import config from '../../../../../config.js';
3
4
 
4
5
  export default function getFolder(req, type = 'server') {
5
6
  if (!['server', 'local'].includes(type)) throw new Error('params type is invalid');
@@ -38,12 +38,12 @@ export default async function logChanges({
38
38
  const filterData = Object.entries({
39
39
  change_id: changeId, entity_key: el, value_old: old[el], value_new: data[el], uid,
40
40
  })
41
- .filter((el) => el[1] && names.includes(el[0]));
41
+ .filter((el1) => el1[1] && names.includes(el1[0]));
42
42
 
43
43
  const insertQuery = `insert into log.table_changes_data (${filterData?.map((key) => `"${key[0]}"`).join(',')})
44
44
  values (${filterData?.map((key, i) => `$${i + 1}`).join(',')}) returning *`;
45
45
 
46
- const { rows = [] } = await pg.query(insertQuery, [...filterData.map((el) => (el[1] && typeof el[1] === 'object' && (!Array.isArray(el[1]) || typeof el[1]?.[0] === 'object') ? JSON.stringify(el[1]) : el[1]))]) || {};
46
+ const { rows = [] } = await pg.query(insertQuery, [...filterData.map((el1) => (el1[1] && typeof el1[1] === 'object' && (!Array.isArray(el1[1]) || typeof el1[1]?.[0] === 'object') ? JSON.stringify(el1[1]) : el1[1]))]) || {};
47
47
  return rows[0];
48
48
  }));
49
49