@opengis/fastify-table 1.0.74 → 1.0.76

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 (64) hide show
  1. package/.eslintrc.cjs +42 -42
  2. package/Changelog.md +237 -229
  3. package/README.md +26 -26
  4. package/config.js +10 -10
  5. package/cron/controllers/cronApi.js +22 -22
  6. package/cron/controllers/utils/cronList.js +1 -1
  7. package/cron/funcs/addCron.js +131 -131
  8. package/cron/index.js +10 -10
  9. package/crud/controllers/deleteCrud.js +1 -1
  10. package/crud/controllers/utils/checkXSS.js +45 -45
  11. package/crud/controllers/utils/xssInjection.js +72 -72
  12. package/crud/funcs/dataDelete.js +15 -15
  13. package/crud/funcs/dataUpdate.js +24 -24
  14. package/crud/funcs/getAccess.js +2 -1
  15. package/crud/funcs/getToken.js +27 -27
  16. package/crud/funcs/isFileExists.js +13 -13
  17. package/crud/funcs/setToken.js +53 -53
  18. package/crud/index.js +36 -36
  19. package/index.js +97 -97
  20. package/migration/exec.migrations.js +75 -75
  21. package/notification/controllers/testEmail.js +49 -49
  22. package/notification/funcs/sendNotification.js +111 -111
  23. package/notification/funcs/utils/sendEmail.js +39 -39
  24. package/notification/index.js +38 -38
  25. package/package.json +26 -26
  26. package/pg/funcs/getPG.js +30 -30
  27. package/redis/funcs/getRedis.js +23 -23
  28. package/server/migrations/0.sql +64 -13
  29. package/server/migrations/crm.sql +150 -150
  30. package/server/migrations/log.sql +43 -43
  31. package/server.js +14 -14
  32. package/table/controllers/card.js +44 -44
  33. package/table/controllers/filter.js +37 -37
  34. package/table/controllers/form.js +28 -28
  35. package/table/controllers/search.js +72 -72
  36. package/table/controllers/suggest.js +62 -62
  37. package/table/controllers/table.js +44 -44
  38. package/table/controllers/utils/getSelectMeta.js +66 -66
  39. package/table/controllers/utils/getTemplate.js +28 -28
  40. package/table/controllers/utils/getTemplates.js +18 -18
  41. package/table/funcs/getFilterSQL/util/getTableSql.js +34 -34
  42. package/table/funcs/metaFormat/index.js +27 -27
  43. package/table/index.js +78 -78
  44. package/test/api/crud.test.js +18 -11
  45. package/test/api/crud.xss.test.js +72 -72
  46. package/test/api/notification.test.js +37 -37
  47. package/test/api/table.test.js +57 -57
  48. package/test/api/widget.test.js +114 -114
  49. package/test/config.example +18 -18
  50. package/test/funcs/crud.test.js +76 -76
  51. package/test/funcs/notification.test.js +31 -31
  52. package/test/funcs/pg.test.js +34 -34
  53. package/test/funcs/redis.test.js +19 -19
  54. package/test/templates/cls/test.json +9 -9
  55. package/test/templates/form/cp_building.form.json +32 -32
  56. package/test/templates/select/account_id.json +3 -3
  57. package/test/templates/select/storage.data.json +2 -2
  58. package/test/templates/table/gis.dataset.table.json +20 -20
  59. package/util/controllers/next.id.js +4 -4
  60. package/util/controllers/properties.add.js +50 -50
  61. package/util/controllers/properties.get.js +19 -19
  62. package/util/controllers/status.monitor.js +3 -0
  63. package/util/index.js +4 -3
  64. package/widget/index.js +40 -40
package/.eslintrc.cjs CHANGED
@@ -1,42 +1,42 @@
1
- /* eslint-env node */
2
-
3
- module.exports = {
4
- env: {
5
- node: true,
6
- },
7
- root: true,
8
- extends: [
9
- 'eslint:recommended',
10
- 'airbnb-base',
11
-
12
- ],
13
- rules: {
14
- 'brace-style': [2, 'stroustrup', { allowSingleLine: true }],
15
- 'vue/max-attributes-per-line': 0,
16
- 'vue/valid-v-for': 0,
17
-
18
- // allow async-await
19
- 'generator-star-spacing': 'off',
20
-
21
- // allow paren-less arrow functions
22
- 'arrow-parens': 0,
23
- 'one-var': 0,
24
- 'max-len': 0,
25
- 'import/first': 0,
26
- 'import/named': 2,
27
- 'import/namespace': 2,
28
- 'import/default': 2,
29
- 'import/export': 2,
30
- 'import/extensions': 0,
31
- 'no-console': ['warn', { allow: ['warn', 'error'] }],
32
- 'import/no-unresolved': 0,
33
- 'import/no-extraneous-dependencies': 0,
34
- 'linebreak-style': ['error', 'unix'],
35
- // allow debugger during development
36
- 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
37
- },
38
-
39
- parserOptions: {
40
- ecmaVersion: 'latest',
41
- },
42
- };
1
+ /* eslint-env node */
2
+
3
+ module.exports = {
4
+ env: {
5
+ node: true,
6
+ },
7
+ root: true,
8
+ extends: [
9
+ 'eslint:recommended',
10
+ 'airbnb-base',
11
+
12
+ ],
13
+ rules: {
14
+ 'brace-style': [2, 'stroustrup', { allowSingleLine: true }],
15
+ 'vue/max-attributes-per-line': 0,
16
+ 'vue/valid-v-for': 0,
17
+
18
+ // allow async-await
19
+ 'generator-star-spacing': 'off',
20
+
21
+ // allow paren-less arrow functions
22
+ 'arrow-parens': 0,
23
+ 'one-var': 0,
24
+ 'max-len': 0,
25
+ 'import/first': 0,
26
+ 'import/named': 2,
27
+ 'import/namespace': 2,
28
+ 'import/default': 2,
29
+ 'import/export': 2,
30
+ 'import/extensions': 0,
31
+ 'no-console': ['warn', { allow: ['warn', 'error'] }],
32
+ 'import/no-unresolved': 0,
33
+ 'import/no-extraneous-dependencies': 0,
34
+ 'linebreak-style': ['error', 'unix'],
35
+ // allow debugger during development
36
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
37
+ },
38
+
39
+ parserOptions: {
40
+ ecmaVersion: 'latest',
41
+ },
42
+ };
package/Changelog.md CHANGED
@@ -1,229 +1,237 @@
1
- # fastify-table
2
-
3
- ## 1.0.71 - 01.08.2024
4
-
5
- - add compile settings to form
6
-
7
- ## 1.0.70 - 29.07.2024
8
-
9
- - add cron funcs and API
10
-
11
- ## 1.0.69 - 26.07.2024
12
-
13
- - add column classifier mode for data API
14
-
15
- ## 1.0.68 - 26.07.2024
16
-
17
- - code optimization
18
-
19
- ## 1.0.66 - 25.07.2024
20
-
21
- - add notification compile template from data params support
22
-
23
- ## 1.0.65 - 23.07.2024
24
-
25
- - add rest API token support
26
-
27
- ## 1.0.62 - 22.07.2024
28
-
29
- - add email notification func and test api
30
-
31
- ## 1.0.61 - 18.07.2024
32
-
33
- - add custom actions for table
34
-
35
- ## 1.0.60 - 12.07.2024
36
-
37
- - code optimization
38
-
39
- ## 1.0.59 - 12.07.2024
40
-
41
- - code optimization
42
-
43
- ## 1.0.58 - 08.07.2024
44
-
45
- - code optimization
46
-
47
- ## 1.0.57 - 04.07.2024
48
-
49
- - fix crud update boolean column
50
-
51
- ## 1.0.56 - 04.07.2024
52
-
53
- - code optimization
54
-
55
- ## 1.0.55 - 02.07.2024
56
-
57
- - callback support
58
-
59
- ## 1.0.54 - 01.07.2024
60
-
61
- - code optimization
62
-
63
- ## 1.0.53 - 28.06.2024
64
-
65
- - add migrations support
66
-
67
- ## 1.0.52 - 28.06.2024
68
-
69
- - add table get api
70
-
71
- ## 1.0.51 - 27.06.2024
72
-
73
- - add next-id api
74
-
75
- ## 1.0.50 - 27.06.2024
76
-
77
- - refactor search api
78
-
79
- ## 1.0.49 - 26.06.2024
80
-
81
- - refactor - npm settings
82
-
83
- ## 1.0.48 - 26.06.2024
84
-
85
- - search api no specified table mode support
86
-
87
- ## 1.0.47 - 25.06.2024
88
-
89
- - add extra properties support
90
-
91
- ## 1.0.46 - 24.06.2024
92
-
93
- - fix data api edit geometry
94
-
95
- ## 1.0.45 - 19.06.2024
96
-
97
- - fix data api table template order
98
-
99
- ## 1.0.44 - 18.06.2024
100
-
101
- - add extra data support (form DataTable)
102
-
103
- ## 1.0.43 - 14.06.2024
104
-
105
- - add settings api, funcs, migration
106
-
107
- ## 1.0.42 - 12.06.2024
108
-
109
- - table cardSql support
110
-
111
- ## 1.0.41 - 12.06.2024
112
-
113
- - cls to db (crm.cls)
114
-
115
- ## 1.0.40 - 12.06.2024
116
-
117
- - fix widget GET API
118
-
119
- ## 1.0.39 - 29.05.2024
120
-
121
- - add getFolder func
122
-
123
- ## 1.0.37 - 23.05.2024
124
-
125
- - add gallery widget
126
-
127
- ## 1.0.36 - 22.05.2024
128
-
129
- - fix filter api array processing
130
-
131
- ## 1.0.31 - 20.05.2024
132
-
133
- - widget db structure refactor
134
-
135
- ## 1.0.30 - 17.05.2024
136
-
137
- - code optimization
138
-
139
- ## 1.0.29 - 17.05.2024
140
-
141
- - widget api post (file)
142
-
143
- ## 1.0.28 - 14.05.2024
144
-
145
- - dblist api set
146
-
147
- ## 1.0.27 - 12.05.2024
148
-
149
- - code optimization
150
-
151
- ## 1.0.26 - 09.05.2024
152
-
153
- - fix getTableSql
154
-
155
- ## 1.0.25 - 08.05.2024
156
-
157
- - decorator to hook
158
-
159
- ## 1.0.24 - 07.05.2024
160
-
161
- - getTemplate page
162
-
163
- ## 1.0.23 - 07.05.2024
164
-
165
- - getTemplate funcs
166
- - dblist api
167
-
168
- ## 1.0.22 - 03.05.2024
169
-
170
- - getFilterSQL funcs
171
-
172
- ## 1.0.21 - 03.05.2024
173
-
174
- - fix widget db structure
175
-
176
- ## 1.0.20 - 03.05.2024
177
-
178
- - fix filter separator
179
-
180
- ## 1.0.19 - 02.05.2024
181
-
182
- - widget plugin
183
- - notification plugin
184
-
185
- ## 1.0.9 - 29.04.2024
186
-
187
- - crud token support
188
- - security - xss restriction
189
-
190
- ## 1.0.8 - 29.04.2024
191
-
192
- - filter fix
193
-
194
- ## 1.0.7 - 26.04.2024
195
-
196
- - code optimization
197
-
198
- ## 1.0.6 - 25.04.2024
199
-
200
- - code optimization
201
-
202
- ## 1.0.5 - 24.04.2024
203
-
204
- - code optimization
205
-
206
- ## 1.0.4 - 20.04.2024
207
-
208
- - data api - order
209
- - suggest api - db support
210
- - del api fix
211
-
212
- ## 1.0.3 - 17.04.2024
213
-
214
- - fix unit test
215
-
216
- ## 1.0.2 - 14.04.2024
217
-
218
- - fix redis
219
-
220
- ## 1.0.1 - 14.04.2024
221
-
222
- - fix redis
223
-
224
- ## 1.0.0 - 14.04.2024
225
-
226
- - crud
227
- - pg
228
- - redis
229
- - table
1
+ # fastify-table
2
+
3
+ ## 1.0.76 - 13.08.2024
4
+
5
+ - add statusMonotor API
6
+
7
+ ## 1.0.75 - 12.08.2024
8
+
9
+ - something do
10
+
11
+ ## 1.0.71 - 01.08.2024
12
+
13
+ - add compile settings to form
14
+
15
+ ## 1.0.70 - 29.07.2024
16
+
17
+ - add cron funcs and API
18
+
19
+ ## 1.0.69 - 26.07.2024
20
+
21
+ - add column classifier mode for data API
22
+
23
+ ## 1.0.68 - 26.07.2024
24
+
25
+ - code optimization
26
+
27
+ ## 1.0.66 - 25.07.2024
28
+
29
+ - add notification compile template from data params support
30
+
31
+ ## 1.0.65 - 23.07.2024
32
+
33
+ - add rest API token support
34
+
35
+ ## 1.0.62 - 22.07.2024
36
+
37
+ - add email notification func and test api
38
+
39
+ ## 1.0.61 - 18.07.2024
40
+
41
+ - add custom actions for table
42
+
43
+ ## 1.0.60 - 12.07.2024
44
+
45
+ - code optimization
46
+
47
+ ## 1.0.59 - 12.07.2024
48
+
49
+ - code optimization
50
+
51
+ ## 1.0.58 - 08.07.2024
52
+
53
+ - code optimization
54
+
55
+ ## 1.0.57 - 04.07.2024
56
+
57
+ - fix crud update boolean column
58
+
59
+ ## 1.0.56 - 04.07.2024
60
+
61
+ - code optimization
62
+
63
+ ## 1.0.55 - 02.07.2024
64
+
65
+ - callback support
66
+
67
+ ## 1.0.54 - 01.07.2024
68
+
69
+ - code optimization
70
+
71
+ ## 1.0.53 - 28.06.2024
72
+
73
+ - add migrations support
74
+
75
+ ## 1.0.52 - 28.06.2024
76
+
77
+ - add table get api
78
+
79
+ ## 1.0.51 - 27.06.2024
80
+
81
+ - add next-id api
82
+
83
+ ## 1.0.50 - 27.06.2024
84
+
85
+ - refactor search api
86
+
87
+ ## 1.0.49 - 26.06.2024
88
+
89
+ - refactor - npm settings
90
+
91
+ ## 1.0.48 - 26.06.2024
92
+
93
+ - search api no specified table mode support
94
+
95
+ ## 1.0.47 - 25.06.2024
96
+
97
+ - add extra properties support
98
+
99
+ ## 1.0.46 - 24.06.2024
100
+
101
+ - fix data api edit geometry
102
+
103
+ ## 1.0.45 - 19.06.2024
104
+
105
+ - fix data api table template order
106
+
107
+ ## 1.0.44 - 18.06.2024
108
+
109
+ - add extra data support (form DataTable)
110
+
111
+ ## 1.0.43 - 14.06.2024
112
+
113
+ - add settings api, funcs, migration
114
+
115
+ ## 1.0.42 - 12.06.2024
116
+
117
+ - table cardSql support
118
+
119
+ ## 1.0.41 - 12.06.2024
120
+
121
+ - cls to db (crm.cls)
122
+
123
+ ## 1.0.40 - 12.06.2024
124
+
125
+ - fix widget GET API
126
+
127
+ ## 1.0.39 - 29.05.2024
128
+
129
+ - add getFolder func
130
+
131
+ ## 1.0.37 - 23.05.2024
132
+
133
+ - add gallery widget
134
+
135
+ ## 1.0.36 - 22.05.2024
136
+
137
+ - fix filter api array processing
138
+
139
+ ## 1.0.31 - 20.05.2024
140
+
141
+ - widget db structure refactor
142
+
143
+ ## 1.0.30 - 17.05.2024
144
+
145
+ - code optimization
146
+
147
+ ## 1.0.29 - 17.05.2024
148
+
149
+ - widget api post (file)
150
+
151
+ ## 1.0.28 - 14.05.2024
152
+
153
+ - dblist api set
154
+
155
+ ## 1.0.27 - 12.05.2024
156
+
157
+ - code optimization
158
+
159
+ ## 1.0.26 - 09.05.2024
160
+
161
+ - fix getTableSql
162
+
163
+ ## 1.0.25 - 08.05.2024
164
+
165
+ - decorator to hook
166
+
167
+ ## 1.0.24 - 07.05.2024
168
+
169
+ - getTemplate page
170
+
171
+ ## 1.0.23 - 07.05.2024
172
+
173
+ - getTemplate funcs
174
+ - dblist api
175
+
176
+ ## 1.0.22 - 03.05.2024
177
+
178
+ - getFilterSQL funcs
179
+
180
+ ## 1.0.21 - 03.05.2024
181
+
182
+ - fix widget db structure
183
+
184
+ ## 1.0.20 - 03.05.2024
185
+
186
+ - fix filter separator
187
+
188
+ ## 1.0.19 - 02.05.2024
189
+
190
+ - widget plugin
191
+ - notification plugin
192
+
193
+ ## 1.0.9 - 29.04.2024
194
+
195
+ - crud token support
196
+ - security - xss restriction
197
+
198
+ ## 1.0.8 - 29.04.2024
199
+
200
+ - filter fix
201
+
202
+ ## 1.0.7 - 26.04.2024
203
+
204
+ - code optimization
205
+
206
+ ## 1.0.6 - 25.04.2024
207
+
208
+ - code optimization
209
+
210
+ ## 1.0.5 - 24.04.2024
211
+
212
+ - code optimization
213
+
214
+ ## 1.0.4 - 20.04.2024
215
+
216
+ - data api - order
217
+ - suggest api - db support
218
+ - del api fix
219
+
220
+ ## 1.0.3 - 17.04.2024
221
+
222
+ - fix unit test
223
+
224
+ ## 1.0.2 - 14.04.2024
225
+
226
+ - fix redis
227
+
228
+ ## 1.0.1 - 14.04.2024
229
+
230
+ - fix redis
231
+
232
+ ## 1.0.0 - 14.04.2024
233
+
234
+ - crud
235
+ - pg
236
+ - redis
237
+ - table
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;
@@ -1,22 +1,22 @@
1
- import cronList from './utils/cronList.js';
2
-
3
- export default async function cronApi(req) {
4
- const {
5
- params = {}, user = {}, hostname,
6
- } = req;
7
-
8
- if ((!user.uid || !user.user_type?.includes('admin')) && !hostname?.includes('localhost')) {
9
- return { message: 'access restricted', status: 403 };
10
- }
11
-
12
- if (params.name === 'list') {
13
- return { data: Object.keys(cronList || {}) };
14
- }
15
-
16
- if (!cronList[params.name]) {
17
- return { message: `cron not found: ${params.name}`, status: 404 };
18
- }
19
-
20
- const result = await cronList[params.name](req);
21
- return result;
22
- }
1
+ import cronList from './utils/cronList.js';
2
+
3
+ export default async function cronApi(req) {
4
+ const {
5
+ params = {}, user = {}, hostname,
6
+ } = req;
7
+
8
+ if ((!user.uid || !user.user_type?.includes('admin')) && !hostname?.includes('localhost')) {
9
+ return { message: 'access restricted', status: 403 };
10
+ }
11
+
12
+ if (params.name === 'list') {
13
+ return { data: Object.keys(cronList || {}) };
14
+ }
15
+
16
+ if (!cronList[params.name]) {
17
+ return { message: `cron not found: ${params.name}`, status: 404 };
18
+ }
19
+
20
+ const result = await cronList[params.name](req);
21
+ return result;
22
+ }
@@ -1 +1 @@
1
- export default {};
1
+ export default {};