@opengis/fastify-table 1.0.92 → 1.0.93

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/Changelog.md +281 -277
  2. package/crud/controllers/deleteCrud.js +22 -22
  3. package/crud/controllers/insert.js +58 -58
  4. package/crud/controllers/update.js +61 -61
  5. package/crud/funcs/dataDelete.js +19 -19
  6. package/crud/funcs/dataInsert.js +30 -30
  7. package/crud/funcs/getAccess.js +53 -53
  8. package/crud/funcs/getOpt.js +10 -10
  9. package/crud/funcs/setOpt.js +16 -16
  10. package/crud/funcs/utils/logChanges.js +71 -71
  11. package/crud/index.js +36 -36
  12. package/helper.js +28 -28
  13. package/index.js +97 -97
  14. package/notification/controllers/userNotifications.js +19 -19
  15. package/notification/funcs/addNotification.js +8 -8
  16. package/package.json +26 -26
  17. package/pg/pgClients.js +20 -20
  18. package/policy/funcs/checkPolicy.js +83 -83
  19. package/policy/funcs/sqlInjection.js +33 -33
  20. package/policy/index.js +14 -14
  21. package/redis/client.js +8 -8
  22. package/redis/funcs/redisClients.js +2 -2
  23. package/redis/index.js +19 -19
  24. package/server/migrations/0.sql +78 -78
  25. package/server/templates/form/test.dataset.form.json +411 -411
  26. package/server/templates/table/test.dataset.table.json +28 -28
  27. package/server/templates/table/test.gis.map.table.json +44 -44
  28. package/table/controllers/data.js +103 -103
  29. package/table/controllers/suggest.js +79 -79
  30. package/table/controllers/table.js +52 -52
  31. package/table/controllers/utils/getSelectMeta.js +66 -66
  32. package/table/controllers/utils/getTemplate.js +28 -28
  33. package/table/controllers/utils/gisIRColumn.js +68 -68
  34. package/table/funcs/getFilterSQL/index.js +79 -75
  35. package/table/funcs/getFilterSQL/util/formatValue.js +142 -142
  36. package/table/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
  37. package/table/funcs/getFilterSQL/util/getFilterQuery.js +73 -73
  38. package/table/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
  39. package/table/funcs/getFilterSQL/util/getTableSql.js +34 -34
  40. package/table/funcs/metaFormat/getSelectVal.js +20 -20
  41. package/table/funcs/metaFormat/index.js +28 -28
  42. package/test/api/crud.test.js +88 -88
  43. package/test/api/table.test.js +89 -89
  44. package/test/api/widget.test.js +117 -117
  45. package/test/funcs/crud.test.js +122 -122
  46. package/util/controllers/properties.add.js +57 -57
  47. package/util/controllers/status.monitor.js +8 -8
  48. package/widget/controllers/utils/historyFormat.js +76 -76
  49. package/widget/controllers/utils/obj2db.js +13 -13
  50. package/widget/controllers/widget.del.js +44 -44
  51. package/widget/controllers/widget.get.js +98 -98
  52. package/widget/controllers/widget.set.js +76 -76
  53. package/widget/index.js +40 -40
package/Changelog.md CHANGED
@@ -1,277 +1,281 @@
1
- # fastify-table
2
-
3
- ## 1.0.92 - 03.08.2024
4
-
5
- - fix getTemplate
6
-
7
- ## 1.0.91 - 30.08.2024
8
-
9
- - add CRUD and Auth logs
10
-
11
- ## 1.0.90 - 27.08.2024
12
-
13
- - logger file API to core
14
-
15
- ## 1.0.89 - 26.08.2024
16
-
17
- - data API meta bbox polyline support
18
-
19
- ## 1.0.87 - 26.08.2024
20
-
21
- - change of null handling method of update crud API
22
-
23
- ## 1.0.86 - 23.08.2024
24
-
25
- - data API meta cls support
26
-
27
- ## 1.0.84 - 22.08.2024
28
-
29
- - suggest table:column support
30
-
31
- ## 1.0.83 - 20.08.2024
32
-
33
- - code optimization
34
-
35
- ## 1.0.81 - 15.08.2024
36
-
37
- - refactor /table API
38
-
39
- ## 1.0.78 - 14.08.2024
40
-
41
- - add sqlColumns to /api/data/:table/?:id
42
-
43
- ## 1.0.77 - 13.08.2024
44
-
45
- - add statusMonitor API
46
-
47
- ## 1.0.75 - 12.08.2024
48
-
49
- - something do
50
-
51
- ## 1.0.71 - 01.08.2024
52
-
53
- - add compile settings to form
54
-
55
- ## 1.0.70 - 29.07.2024
56
-
57
- - add cron funcs and API
58
-
59
- ## 1.0.69 - 26.07.2024
60
-
61
- - add column classifier mode for data API
62
-
63
- ## 1.0.68 - 26.07.2024
64
-
65
- - code optimization
66
-
67
- ## 1.0.66 - 25.07.2024
68
-
69
- - add notification compile template from data params support
70
-
71
- ## 1.0.65 - 23.07.2024
72
-
73
- - add rest API token support
74
-
75
- ## 1.0.62 - 22.07.2024
76
-
77
- - add email notification func and test api
78
-
79
- ## 1.0.61 - 18.07.2024
80
-
81
- - add custom actions for table
82
-
83
- ## 1.0.60 - 12.07.2024
84
-
85
- - code optimization
86
-
87
- ## 1.0.59 - 12.07.2024
88
-
89
- - code optimization
90
-
91
- ## 1.0.58 - 08.07.2024
92
-
93
- - code optimization
94
-
95
- ## 1.0.57 - 04.07.2024
96
-
97
- - fix crud update boolean column
98
-
99
- ## 1.0.56 - 04.07.2024
100
-
101
- - code optimization
102
-
103
- ## 1.0.55 - 02.07.2024
104
-
105
- - callback support
106
-
107
- ## 1.0.54 - 01.07.2024
108
-
109
- - code optimization
110
-
111
- ## 1.0.53 - 28.06.2024
112
-
113
- - add migrations support
114
-
115
- ## 1.0.52 - 28.06.2024
116
-
117
- - add table get api
118
-
119
- ## 1.0.51 - 27.06.2024
120
-
121
- - add next-id api
122
-
123
- ## 1.0.50 - 27.06.2024
124
-
125
- - refactor search api
126
-
127
- ## 1.0.49 - 26.06.2024
128
-
129
- - refactor - npm settings
130
-
131
- ## 1.0.48 - 26.06.2024
132
-
133
- - search api no specified table mode support
134
-
135
- ## 1.0.47 - 25.06.2024
136
-
137
- - add extra properties support
138
-
139
- ## 1.0.46 - 24.06.2024
140
-
141
- - fix data api edit geometry
142
-
143
- ## 1.0.45 - 19.06.2024
144
-
145
- - fix data api table template order
146
-
147
- ## 1.0.44 - 18.06.2024
148
-
149
- - add extra data support (form DataTable)
150
-
151
- ## 1.0.43 - 14.06.2024
152
-
153
- - add settings api, funcs, migration
154
-
155
- ## 1.0.42 - 12.06.2024
156
-
157
- - table cardSql support
158
-
159
- ## 1.0.41 - 12.06.2024
160
-
161
- - cls to db (crm.cls)
162
-
163
- ## 1.0.40 - 12.06.2024
164
-
165
- - fix widget GET API
166
-
167
- ## 1.0.39 - 29.05.2024
168
-
169
- - add getFolder func
170
-
171
- ## 1.0.37 - 23.05.2024
172
-
173
- - add gallery widget
174
-
175
- ## 1.0.36 - 22.05.2024
176
-
177
- - fix filter api array processing
178
-
179
- ## 1.0.31 - 20.05.2024
180
-
181
- - widget db structure refactor
182
-
183
- ## 1.0.30 - 17.05.2024
184
-
185
- - code optimization
186
-
187
- ## 1.0.29 - 17.05.2024
188
-
189
- - widget api post (file)
190
-
191
- ## 1.0.28 - 14.05.2024
192
-
193
- - dblist api set
194
-
195
- ## 1.0.27 - 12.05.2024
196
-
197
- - code optimization
198
-
199
- ## 1.0.26 - 09.05.2024
200
-
201
- - fix getTableSql
202
-
203
- ## 1.0.25 - 08.05.2024
204
-
205
- - decorator to hook
206
-
207
- ## 1.0.24 - 07.05.2024
208
-
209
- - getTemplate page
210
-
211
- ## 1.0.23 - 07.05.2024
212
-
213
- - getTemplate funcs
214
- - dblist api
215
-
216
- ## 1.0.22 - 03.05.2024
217
-
218
- - getFilterSQL funcs
219
-
220
- ## 1.0.21 - 03.05.2024
221
-
222
- - fix widget db structure
223
-
224
- ## 1.0.20 - 03.05.2024
225
-
226
- - fix filter separator
227
-
228
- ## 1.0.19 - 02.05.2024
229
-
230
- - widget plugin
231
- - notification plugin
232
-
233
- ## 1.0.9 - 29.04.2024
234
-
235
- - crud token support
236
- - security - xss restriction
237
-
238
- ## 1.0.8 - 29.04.2024
239
-
240
- - filter fix
241
-
242
- ## 1.0.7 - 26.04.2024
243
-
244
- - code optimization
245
-
246
- ## 1.0.6 - 25.04.2024
247
-
248
- - code optimization
249
-
250
- ## 1.0.5 - 24.04.2024
251
-
252
- - code optimization
253
-
254
- ## 1.0.4 - 20.04.2024
255
-
256
- - data api - order
257
- - suggest api - db support
258
- - del api fix
259
-
260
- ## 1.0.3 - 17.04.2024
261
-
262
- - fix unit test
263
-
264
- ## 1.0.2 - 14.04.2024
265
-
266
- - fix redis
267
-
268
- ## 1.0.1 - 14.04.2024
269
-
270
- - fix redis
271
-
272
- ## 1.0.0 - 14.04.2024
273
-
274
- - crud
275
- - pg
276
- - redis
277
- - table
1
+ # fastify-table
2
+
3
+ ## 1.0.93 - 05.09.2024
4
+
5
+ - fix data API with sql columns filter
6
+
7
+ ## 1.0.92 - 03.09.2024
8
+
9
+ - fix getTemplate
10
+
11
+ ## 1.0.91 - 30.08.2024
12
+
13
+ - add CRUD and Auth logs
14
+
15
+ ## 1.0.90 - 27.08.2024
16
+
17
+ - logger file API to core
18
+
19
+ ## 1.0.89 - 26.08.2024
20
+
21
+ - data API meta bbox polyline support
22
+
23
+ ## 1.0.87 - 26.08.2024
24
+
25
+ - change of null handling method of update crud API
26
+
27
+ ## 1.0.86 - 23.08.2024
28
+
29
+ - data API meta cls support
30
+
31
+ ## 1.0.84 - 22.08.2024
32
+
33
+ - suggest table:column support
34
+
35
+ ## 1.0.83 - 20.08.2024
36
+
37
+ - code optimization
38
+
39
+ ## 1.0.81 - 15.08.2024
40
+
41
+ - refactor /table API
42
+
43
+ ## 1.0.78 - 14.08.2024
44
+
45
+ - add sqlColumns to /api/data/:table/?:id
46
+
47
+ ## 1.0.77 - 13.08.2024
48
+
49
+ - add statusMonitor API
50
+
51
+ ## 1.0.75 - 12.08.2024
52
+
53
+ - something do
54
+
55
+ ## 1.0.71 - 01.08.2024
56
+
57
+ - add compile settings to form
58
+
59
+ ## 1.0.70 - 29.07.2024
60
+
61
+ - add cron funcs and API
62
+
63
+ ## 1.0.69 - 26.07.2024
64
+
65
+ - add column classifier mode for data API
66
+
67
+ ## 1.0.68 - 26.07.2024
68
+
69
+ - code optimization
70
+
71
+ ## 1.0.66 - 25.07.2024
72
+
73
+ - add notification compile template from data params support
74
+
75
+ ## 1.0.65 - 23.07.2024
76
+
77
+ - add rest API token support
78
+
79
+ ## 1.0.62 - 22.07.2024
80
+
81
+ - add email notification func and test api
82
+
83
+ ## 1.0.61 - 18.07.2024
84
+
85
+ - add custom actions for table
86
+
87
+ ## 1.0.60 - 12.07.2024
88
+
89
+ - code optimization
90
+
91
+ ## 1.0.59 - 12.07.2024
92
+
93
+ - code optimization
94
+
95
+ ## 1.0.58 - 08.07.2024
96
+
97
+ - code optimization
98
+
99
+ ## 1.0.57 - 04.07.2024
100
+
101
+ - fix crud update boolean column
102
+
103
+ ## 1.0.56 - 04.07.2024
104
+
105
+ - code optimization
106
+
107
+ ## 1.0.55 - 02.07.2024
108
+
109
+ - callback support
110
+
111
+ ## 1.0.54 - 01.07.2024
112
+
113
+ - code optimization
114
+
115
+ ## 1.0.53 - 28.06.2024
116
+
117
+ - add migrations support
118
+
119
+ ## 1.0.52 - 28.06.2024
120
+
121
+ - add table get api
122
+
123
+ ## 1.0.51 - 27.06.2024
124
+
125
+ - add next-id api
126
+
127
+ ## 1.0.50 - 27.06.2024
128
+
129
+ - refactor search api
130
+
131
+ ## 1.0.49 - 26.06.2024
132
+
133
+ - refactor - npm settings
134
+
135
+ ## 1.0.48 - 26.06.2024
136
+
137
+ - search api no specified table mode support
138
+
139
+ ## 1.0.47 - 25.06.2024
140
+
141
+ - add extra properties support
142
+
143
+ ## 1.0.46 - 24.06.2024
144
+
145
+ - fix data api edit geometry
146
+
147
+ ## 1.0.45 - 19.06.2024
148
+
149
+ - fix data api table template order
150
+
151
+ ## 1.0.44 - 18.06.2024
152
+
153
+ - add extra data support (form DataTable)
154
+
155
+ ## 1.0.43 - 14.06.2024
156
+
157
+ - add settings api, funcs, migration
158
+
159
+ ## 1.0.42 - 12.06.2024
160
+
161
+ - table cardSql support
162
+
163
+ ## 1.0.41 - 12.06.2024
164
+
165
+ - cls to db (crm.cls)
166
+
167
+ ## 1.0.40 - 12.06.2024
168
+
169
+ - fix widget GET API
170
+
171
+ ## 1.0.39 - 29.05.2024
172
+
173
+ - add getFolder func
174
+
175
+ ## 1.0.37 - 23.05.2024
176
+
177
+ - add gallery widget
178
+
179
+ ## 1.0.36 - 22.05.2024
180
+
181
+ - fix filter api array processing
182
+
183
+ ## 1.0.31 - 20.05.2024
184
+
185
+ - widget db structure refactor
186
+
187
+ ## 1.0.30 - 17.05.2024
188
+
189
+ - code optimization
190
+
191
+ ## 1.0.29 - 17.05.2024
192
+
193
+ - widget api post (file)
194
+
195
+ ## 1.0.28 - 14.05.2024
196
+
197
+ - dblist api set
198
+
199
+ ## 1.0.27 - 12.05.2024
200
+
201
+ - code optimization
202
+
203
+ ## 1.0.26 - 09.05.2024
204
+
205
+ - fix getTableSql
206
+
207
+ ## 1.0.25 - 08.05.2024
208
+
209
+ - decorator to hook
210
+
211
+ ## 1.0.24 - 07.05.2024
212
+
213
+ - getTemplate page
214
+
215
+ ## 1.0.23 - 07.05.2024
216
+
217
+ - getTemplate funcs
218
+ - dblist api
219
+
220
+ ## 1.0.22 - 03.05.2024
221
+
222
+ - getFilterSQL funcs
223
+
224
+ ## 1.0.21 - 03.05.2024
225
+
226
+ - fix widget db structure
227
+
228
+ ## 1.0.20 - 03.05.2024
229
+
230
+ - fix filter separator
231
+
232
+ ## 1.0.19 - 02.05.2024
233
+
234
+ - widget plugin
235
+ - notification plugin
236
+
237
+ ## 1.0.9 - 29.04.2024
238
+
239
+ - crud token support
240
+ - security - xss restriction
241
+
242
+ ## 1.0.8 - 29.04.2024
243
+
244
+ - filter fix
245
+
246
+ ## 1.0.7 - 26.04.2024
247
+
248
+ - code optimization
249
+
250
+ ## 1.0.6 - 25.04.2024
251
+
252
+ - code optimization
253
+
254
+ ## 1.0.5 - 24.04.2024
255
+
256
+ - code optimization
257
+
258
+ ## 1.0.4 - 20.04.2024
259
+
260
+ - data api - order
261
+ - suggest api - db support
262
+ - del api fix
263
+
264
+ ## 1.0.3 - 17.04.2024
265
+
266
+ - fix unit test
267
+
268
+ ## 1.0.2 - 14.04.2024
269
+
270
+ - fix redis
271
+
272
+ ## 1.0.1 - 14.04.2024
273
+
274
+ - fix redis
275
+
276
+ ## 1.0.0 - 14.04.2024
277
+
278
+ - crud
279
+ - pg
280
+ - redis
281
+ - table
@@ -1,22 +1,22 @@
1
- import dataDelete from '../funcs/dataDelete.js';
2
- import getTemplate from '../../table/controllers/utils/getTemplate.js';
3
- import getAccess from '../funcs/getAccess.js';
4
-
5
- export default async function deleteCrud(req) {
6
- const { actions = [], scope, my } = await getAccess(req, req.params.table, req.params.id) || {};
7
- if (!actions.includes('del') || (scope === 'my' && !my)) {
8
- return { message: 'access restricted', status: 403 };
9
- }
10
- const loadTemplate = await getTemplate('table', req.opt?.table || req.params.table);
11
- const { table } = loadTemplate || req.opt || req.params || {};
12
- const { id } = req.opt || req.params || {};
13
-
14
- if (!table) return { status: 404, message: 'table is required' };
15
-
16
- const { user = {} } = req;
17
- const data = await dataDelete({
18
- table, id, uid: user?.uid,
19
- });
20
-
21
- return { rowCount: data.rowCount, msg: !data.rowCount ? data : null };
22
- }
1
+ import dataDelete from '../funcs/dataDelete.js';
2
+ import getTemplate from '../../table/controllers/utils/getTemplate.js';
3
+ import getAccess from '../funcs/getAccess.js';
4
+
5
+ export default async function deleteCrud(req) {
6
+ const { actions = [], scope, my } = await getAccess(req, req.params.table, req.params.id) || {};
7
+ if (!actions.includes('del') || (scope === 'my' && !my)) {
8
+ return { message: 'access restricted', status: 403 };
9
+ }
10
+ const loadTemplate = await getTemplate('table', req.opt?.table || req.params.table);
11
+ const { table } = loadTemplate || req.opt || req.params || {};
12
+ const { id } = req.opt || req.params || {};
13
+
14
+ if (!table) return { status: 404, message: 'table is required' };
15
+
16
+ const { user = {} } = req;
17
+ const data = await dataDelete({
18
+ table, id, uid: user?.uid,
19
+ });
20
+
21
+ return { rowCount: data.rowCount, msg: !data.rowCount ? data : null };
22
+ }