@opengis/fastify-table 1.0.30 → 1.0.32

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 (89) hide show
  1. package/.eslintrc.cjs +42 -42
  2. package/Changelog.md +101 -97
  3. package/README.md +26 -26
  4. package/config.js +11 -11
  5. package/crud/controllers/deleteCrud.js +14 -14
  6. package/crud/controllers/insert.js +29 -29
  7. package/crud/controllers/update.js +31 -31
  8. package/crud/controllers/utils/checkXSS.js +45 -45
  9. package/crud/controllers/utils/xssInjection.js +72 -72
  10. package/crud/funcs/dataDelete.js +15 -15
  11. package/crud/funcs/dataInsert.js +24 -24
  12. package/crud/funcs/dataUpdate.js +24 -24
  13. package/crud/funcs/getOpt.js +10 -10
  14. package/crud/funcs/getToken.js +27 -27
  15. package/crud/funcs/isFileExists.js +13 -13
  16. package/crud/funcs/setOpt.js +16 -16
  17. package/crud/funcs/setToken.js +53 -53
  18. package/crud/index.js +29 -29
  19. package/helper.js +28 -28
  20. package/index.js +39 -41
  21. package/notification/controllers/userNotifications.js +19 -19
  22. package/notification/funcs/addNotification.js +8 -8
  23. package/notification/index.js +19 -19
  24. package/package.json +22 -22
  25. package/pg/funcs/getPG.js +29 -29
  26. package/pg/index.js +1 -1
  27. package/pg/pgClients.js +20 -20
  28. package/policy/funcs/checkPolicy.js +74 -74
  29. package/policy/funcs/sqlInjection.js +33 -33
  30. package/policy/index.js +14 -14
  31. package/redis/client.js +8 -8
  32. package/redis/funcs/getRedis.js +23 -23
  33. package/redis/funcs/redisClients.js +2 -2
  34. package/redis/index.js +19 -19
  35. package/server/migrations/crm.sql +95 -57
  36. package/server/migrations/log.sql +41 -41
  37. package/server/templates/form/test.dataset.form.json +411 -411
  38. package/server/templates/select/test.storage.data.json +2 -2
  39. package/server/templates/table/test.dataset.table.json +24 -24
  40. package/server.js +14 -14
  41. package/table/controllers/data.js +57 -57
  42. package/table/controllers/filter.js +32 -32
  43. package/table/controllers/form.js +10 -10
  44. package/table/controllers/search.js +41 -41
  45. package/table/controllers/suggest.js +60 -60
  46. package/table/controllers/utils/getSelect.js +20 -20
  47. package/table/controllers/utils/getSelectMeta.js +66 -66
  48. package/table/controllers/utils/getTemplate.js +28 -28
  49. package/table/funcs/getFilterSQL/index.js +75 -75
  50. package/table/funcs/getFilterSQL/util/formatValue.js +142 -142
  51. package/table/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
  52. package/table/funcs/getFilterSQL/util/getFilterQuery.js +73 -73
  53. package/table/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
  54. package/table/funcs/getFilterSQL/util/getTableSql.js +34 -34
  55. package/table/funcs/metaFormat/getSelectVal.js +20 -20
  56. package/table/funcs/metaFormat/index.js +26 -26
  57. package/table/index.js +42 -42
  58. package/test/api/crud.test.js +56 -56
  59. package/test/api/crud.xss.test.js +71 -71
  60. package/test/api/notification.test.js +37 -37
  61. package/test/api/table.test.js +57 -57
  62. package/test/api/widget.test.js +114 -39
  63. package/test/config.example +18 -18
  64. package/test/funcs/crud.test.js +76 -76
  65. package/test/funcs/notification.test.js +31 -31
  66. package/test/funcs/pg.test.js +34 -34
  67. package/test/funcs/redis.test.js +19 -19
  68. package/test/templates/cls/test.json +9 -9
  69. package/test/templates/form/cp_building.form.json +32 -32
  70. package/test/templates/select/account_id.json +3 -3
  71. package/test/templates/select/storage.data.json +2 -2
  72. package/test/templates/table/gis.dataset.table.json +20 -20
  73. package/widget/controllers/utils/historyFormat.js +76 -76
  74. package/widget/controllers/utils/obj2db.js +13 -13
  75. package/widget/controllers/widget.del.js +41 -40
  76. package/widget/controllers/widget.get.js +77 -74
  77. package/widget/controllers/widget.set.js +64 -61
  78. package/widget/index.js +29 -29
  79. package/dblist/controllers/createItem.js +0 -32
  80. package/dblist/controllers/deleteItem.js +0 -14
  81. package/dblist/controllers/readItems.js +0 -10
  82. package/dblist/controllers/setItem.js +0 -21
  83. package/dblist/controllers/updateItem.js +0 -25
  84. package/dblist/controllers/utils/checkItem.js +0 -24
  85. package/dblist/controllers/utils/formatData.js +0 -7
  86. package/dblist/index.js +0 -49
  87. package/server/migrations/notifications.sql +0 -14
  88. package/test/api/dblist.test.js +0 -59
  89. package/test/widget.test.js +0 -39
@@ -1,59 +0,0 @@
1
- import { test } from 'node:test';
2
- import assert from 'node:assert';
3
-
4
- import build from '../../helper.js';
5
- import config from '../config.js';
6
-
7
- const prefix = config.prefix || '/api';
8
-
9
- test('api dblist', async (t) => {
10
- const app = await build(t);
11
- await t.test('GET /list', async () => {
12
- const res = await app.inject({
13
- method: 'GET',
14
- url: `${prefix}/list`,
15
- });
16
- const rep = JSON.parse(res?.body);
17
- assert.ok(rep.data);
18
- });
19
- let id;
20
- await t.test('POST /list', async () => {
21
- const res = await app.inject({
22
- method: 'POST',
23
- url: `${prefix}/list`,
24
- body: {
25
- key: 'testDB', name: 'testTitle', host: '192.168.3.160', database: 'mbk_kr_prod', port: 5432,
26
- },
27
- });
28
- const rep = JSON.parse(res?.body);
29
- id = rep.data?.find((el) => el.key === 'testDB')?.id;
30
- assert.ok(id);
31
- });
32
- await t.test('PUT /list/:id', async () => {
33
- const res = await app.inject({
34
- method: 'PUT',
35
- url: `${prefix}/list/${id}`,
36
- body: {
37
- key: 'testDB1', name: 'testTitle1', host: '192.168.3.160', database: 'mbk_kr_prod', port: 5434,
38
- },
39
- });
40
- const rep = JSON.parse(res?.body);
41
- assert.ok(rep.data);
42
- });
43
- await t.test('SET /list/:id', async () => {
44
- const res = await app.inject({
45
- method: 'GET',
46
- url: `${prefix}/list/${id}`,
47
- });
48
- const rep = JSON.parse(res?.body);
49
- assert.ok(rep.current);
50
- });
51
- await t.test('DELETE /list/:id', async () => {
52
- const res = await app.inject({
53
- method: 'DELETE',
54
- url: `${prefix}/list/${id}`,
55
- });
56
- const rep = JSON.parse(res?.body);
57
- assert.ok(rep.data);
58
- });
59
- });
@@ -1,39 +0,0 @@
1
- import { test } from 'node:test';
2
- import assert from 'node:assert';
3
-
4
- import build from '../helper.js';
5
- import config from '../config.js';
6
-
7
- const session = { passport: { user: { uid: config.testUser?.uid || '1' } } };
8
-
9
- import widgetGet from '../widget/controllers/widget.get.js';
10
- import widgetSet from '../widget/controllers/widget.set.js';
11
- import widgetDel from '../widget/controllers/widget.del.js';
12
-
13
- import pgClients from '../pg/pgClients.js';
14
-
15
- test('api && funcs notification', async (t) => {
16
- const app = await build(t);
17
- const pg = pgClients.client;
18
- await t.test('POST /widget/:type/:objectid', async () => {
19
- const body = {};
20
- const rep = await widgetSet({
21
- pg, params: { type: 'comment', objectid: '1' }, session, body,
22
- });
23
- assert.ok(rep.data);
24
- });
25
-
26
- let resp;
27
- await t.test('GET /widget/:type/:objectid', async () => {
28
- resp = await widgetGet({
29
- pg, session, params: { type: 'comment', objectid: '1' },
30
- });
31
- assert.ok(resp.rows.length > 0, 'widget data get fail');
32
- });
33
- await t.test('DELETE /widget/:type/:objectid', async () => {
34
- resp = await widgetDel({
35
- pg, session, params: { type: 'comment', objectid: '1', id: resp.rows?.find((row) => row)?.comment_id },
36
- });
37
- assert.ok(resp.data.rowCount === 1, 'widget data delete fail');
38
- });
39
- });