@opengis/fastify-table 1.4.52 → 1.4.54
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.
- package/README.md +86 -86
- package/index.js +8 -6
- package/package.json +1 -1
- package/server/helpers/core/buttonHelper.js +1 -1
- package/server/helpers/format/formatAuto.js +13 -13
- package/server/helpers/format/formatDate.js +258 -258
- package/server/helpers/format/formatDigit.js +21 -21
- package/server/helpers/format/formatNum.js +365 -365
- package/server/helpers/format/formatNumber.js +55 -55
- package/server/helpers/format/formatRelative.js +106 -106
- package/server/helpers/format/formatUnit.js +40 -40
- package/server/helpers/format/num_format.js +44 -44
- package/server/helpers/format/set.js +2 -2
- package/server/helpers/funcs/_math.js +50 -50
- package/server/helpers/funcs/empty.js +21 -21
- package/server/helpers/funcs/ifCond.js +109 -109
- package/server/helpers/funcs/ifCondAnd.js +114 -114
- package/server/helpers/funcs/ifCondOr.js +115 -115
- package/server/helpers/funcs/inc.js +20 -20
- package/server/helpers/funcs/json.js +3 -3
- package/server/helpers/funcs/qrcode.js +2 -2
- package/server/helpers/funcs/round.js +29 -29
- package/server/helpers/list/buttonHelper.js +22 -22
- package/server/helpers/list/utils/button.js +4 -4
- package/server/helpers/string/coalesce.js +39 -39
- package/server/helpers/string/concat.js +28 -28
- package/server/helpers/string/split.js +20 -20
- package/server/helpers/string/str_replace.js +62 -62
- package/server/helpers/string/substr.js +32 -32
- package/server/helpers/string/translit.js +23 -23
- package/server/helpers/string/utils/alphabet.js +76 -76
- package/server/helpers/utils/button.js +4 -4
- package/server/helpers/utils/buttonAdd.js +1 -1
- package/server/helpers/utils/buttonDel.js +1 -1
- package/server/helpers/utils/buttonDownload.js +1 -1
- package/server/helpers/utils/buttonEdit.js +2 -2
- package/server/helpers/utils/buttonPreview.js +1 -1
- package/server/helpers/utils/mdToHTML.js +17 -17
- package/server/plugins/cron/funcs/interval2ms.js +1 -1
- package/server/plugins/cron/index.js +77 -77
- package/server/plugins/crud/funcs/getAccess.js +3 -2
- package/server/plugins/crud/funcs/setOpt.js +21 -21
- package/server/plugins/crud/funcs/setToken.js +43 -43
- package/server/plugins/crud/index.js +23 -23
- package/server/plugins/hook/index.js +8 -8
- package/server/plugins/logger/index.js +33 -33
- package/server/plugins/logger/timestampWithTimeZone.js +1 -1
- package/server/plugins/migration/index.js +7 -7
- package/server/plugins/pg/funcs/getDBParams.js +3 -3
- package/server/plugins/policy/sqlInjection.js +34 -34
- package/server/plugins/redis/index.js +17 -17
- package/server/plugins/table/funcs/customTokens.js +1 -1
- package/server/plugins/table/funcs/getFilterSQL/index.js +2 -2
- package/server/plugins/table/funcs/getFilterSQL/util/formatValue.js +1 -1
- package/server/plugins/table/funcs/getFilterSQL/util/getOptimizedQuery.js +2 -2
- package/server/plugins/table/funcs/userTokens.js +1 -1
- package/server/plugins/util/index.js +7 -7
- package/server/plugins/yml/funcs/json2yml.js +1 -1
- package/server/plugins/yml/funcs/yml2json.js +2 -2
- package/server/routes/file/controllers/export.js +1 -1
- package/server/routes/file/controllers/utils/jsonToXls.js +1 -2
- package/server/routes/logger/controllers/utils/getRootDir.js +27 -27
- package/server/routes/table/controllers/utils/locales.js +1 -1
- package/server/routes/table/index.js +4 -4
- package/server/routes/util/controllers/status.monitor.js +8 -8
package/README.md
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
# fastify-table
|
|
2
|
-
|
|
3
|
-
<!--  -->
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@opengis/fastify-table)
|
|
6
|
-
[]()
|
|
7
|
-
[]()
|
|
8
|
-
[](http://standardjs.com/)
|
|
9
|
-
|
|
10
|
-
This is a backend toolkit for database management and more.
|
|
11
|
-
|
|
12
|
-
### Why fastify-table?
|
|
13
|
-
|
|
14
|
-
- **Logger** - Monitoring user activity and system status.
|
|
15
|
-
- **Redis cache** - Optimizes web page rendering for lightning-fast performance.
|
|
16
|
-
- **Secure** - Ensures protection against XSS attacks in queries.
|
|
17
|
-
- **SQL Migration** - Automatically adds all necessary tables to your project's database.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Features
|
|
21
|
-
|
|
22
|
-
- CRUD
|
|
23
|
-
- cron
|
|
24
|
-
- Logger
|
|
25
|
-
- Redis
|
|
26
|
-
- pg
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
### Install
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npm i @opengis/fastify-table
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Usage
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
fastify.register(import('@opengis/fastify-table'), config);
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
### Documenation
|
|
45
|
-
|
|
46
|
-
For a detailed understanding `fastify-table`, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/fastify-table/).
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
### Technology stack
|
|
51
|
-
|
|
52
|
-
<a href="https://fastify.dev/" target="_blank">
|
|
53
|
-
<img src="https://img.shields.io/badge/Fastify-323330?style=for-the-badge&logo=fastify" /></a>
|
|
54
|
-
|
|
55
|
-
<a href="https://www.postgresql.org/" target="_blank">
|
|
56
|
-
<img src="https://img.shields.io/badge/PostgreSQL-323330?style=for-the-badge&logo=postgresql&logoColor=white" /></a>
|
|
57
|
-
|
|
58
|
-
<a href="https://redis.io/" target="_blank">
|
|
59
|
-
<img src="https://img.shields.io/badge/redis-323330.svg?&style=for-the-badge&logo=redis&logoColor=" /></a>
|
|
60
|
-
|
|
61
|
-
<a href="https://www.npmjs.com/package/pino" target="_blank">
|
|
62
|
-
<img src="https://img.shields.io/badge/pino-323330.svg?&style=for-the-badge&logo=pino&logoColor=" /></a>
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
### Contribute
|
|
67
|
-
|
|
68
|
-
Feel free to contact us through our website [SOFTPRO.UA](https://softpro.ua) or email <info@softpro.ua>
|
|
69
|
-
|
|
70
|
-
- Report bugs
|
|
71
|
-
- Share your ideas
|
|
72
|
-
- Ask questions
|
|
73
|
-
|
|
74
|
-
### Follow Us
|
|
75
|
-
|
|
76
|
-
[Official site](https://softpro.ua)
|
|
77
|
-
|
|
78
|
-
<p>
|
|
79
|
-
<a href="https://www.instagram.com/gissoftpro/" target="_blank"><img src="https://cdn.softpro.ua/data/npm/instagram.png" alt="Softpro Instagram" title="oftpro Instagram"></a>
|
|
80
|
-
<a href="https://www.facebook.com/gissoftpro" target="_blank"><img src="https://cdn.softpro.ua/data/npm/facebook.png" alt="Softpro Facebook" title="Softpro Facebook"></a>
|
|
81
|
-
<a href="https://t.me/softprogis" target="_blank"><img src="https://cdn.softpro.ua/data/npm/telegram.png" alt="Softpro Telegram" title="Softpro Telegram"></a>
|
|
82
|
-
<a href="https://www.linkedin.com/in/softpro-ukraine-a8876b282/recent-activity/all/" target="_blank"><img src="https://cdn.softpro.ua/data/npm/social/linkedin.png" alt="Softpro Linkedin" title="Softpro LinkedIn"></a>
|
|
83
|
-
</p>
|
|
84
|
-
|
|
85
|
-
### License
|
|
86
|
-
|
|
1
|
+
# fastify-table
|
|
2
|
+
|
|
3
|
+
<!--  -->
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@opengis/fastify-table)
|
|
6
|
+
[]()
|
|
7
|
+
[]()
|
|
8
|
+
[](http://standardjs.com/)
|
|
9
|
+
|
|
10
|
+
This is a backend toolkit for database management and more.
|
|
11
|
+
|
|
12
|
+
### Why fastify-table?
|
|
13
|
+
|
|
14
|
+
- **Logger** - Monitoring user activity and system status.
|
|
15
|
+
- **Redis cache** - Optimizes web page rendering for lightning-fast performance.
|
|
16
|
+
- **Secure** - Ensures protection against XSS attacks in queries.
|
|
17
|
+
- **SQL Migration** - Automatically adds all necessary tables to your project's database.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- CRUD
|
|
23
|
+
- cron
|
|
24
|
+
- Logger
|
|
25
|
+
- Redis
|
|
26
|
+
- pg
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
### Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm i @opengis/fastify-table
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Usage
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
fastify.register(import('@opengis/fastify-table'), config);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### Documenation
|
|
45
|
+
|
|
46
|
+
For a detailed understanding `fastify-table`, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/fastify-table/).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### Technology stack
|
|
51
|
+
|
|
52
|
+
<a href="https://fastify.dev/" target="_blank">
|
|
53
|
+
<img src="https://img.shields.io/badge/Fastify-323330?style=for-the-badge&logo=fastify" /></a>
|
|
54
|
+
|
|
55
|
+
<a href="https://www.postgresql.org/" target="_blank">
|
|
56
|
+
<img src="https://img.shields.io/badge/PostgreSQL-323330?style=for-the-badge&logo=postgresql&logoColor=white" /></a>
|
|
57
|
+
|
|
58
|
+
<a href="https://redis.io/" target="_blank">
|
|
59
|
+
<img src="https://img.shields.io/badge/redis-323330.svg?&style=for-the-badge&logo=redis&logoColor=" /></a>
|
|
60
|
+
|
|
61
|
+
<a href="https://www.npmjs.com/package/pino" target="_blank">
|
|
62
|
+
<img src="https://img.shields.io/badge/pino-323330.svg?&style=for-the-badge&logo=pino&logoColor=" /></a>
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### Contribute
|
|
67
|
+
|
|
68
|
+
Feel free to contact us through our website [SOFTPRO.UA](https://softpro.ua) or email <info@softpro.ua>
|
|
69
|
+
|
|
70
|
+
- Report bugs
|
|
71
|
+
- Share your ideas
|
|
72
|
+
- Ask questions
|
|
73
|
+
|
|
74
|
+
### Follow Us
|
|
75
|
+
|
|
76
|
+
[Official site](https://softpro.ua)
|
|
77
|
+
|
|
78
|
+
<p>
|
|
79
|
+
<a href="https://www.instagram.com/gissoftpro/" target="_blank"><img src="https://cdn.softpro.ua/data/npm/instagram.png" alt="Softpro Instagram" title="oftpro Instagram"></a>
|
|
80
|
+
<a href="https://www.facebook.com/gissoftpro" target="_blank"><img src="https://cdn.softpro.ua/data/npm/facebook.png" alt="Softpro Facebook" title="Softpro Facebook"></a>
|
|
81
|
+
<a href="https://t.me/softprogis" target="_blank"><img src="https://cdn.softpro.ua/data/npm/telegram.png" alt="Softpro Telegram" title="Softpro Telegram"></a>
|
|
82
|
+
<a href="https://www.linkedin.com/in/softpro-ukraine-a8876b282/recent-activity/all/" target="_blank"><img src="https://cdn.softpro.ua/data/npm/social/linkedin.png" alt="Softpro Linkedin" title="Softpro LinkedIn"></a>
|
|
83
|
+
</p>
|
|
84
|
+
|
|
85
|
+
### License
|
|
86
|
+
|
|
87
87
|
Copyright © SOFTPRO. All rights reserved.
|
package/index.js
CHANGED
|
@@ -105,12 +105,14 @@ async function plugin(fastify, opt) {
|
|
|
105
105
|
cronPlugin(fastify, opt);
|
|
106
106
|
loggerPlugin(fastify, opt);
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
if (config.rateLimit !== false) {
|
|
109
|
+
await fastify.register(import('@fastify/rate-limit'), {
|
|
110
|
+
max: config.rateLimit?.max || 100,
|
|
111
|
+
timeWindow: config.rateLimit?.timeWindow || '1 minute',
|
|
112
|
+
global: true,
|
|
113
|
+
keyGenerator: (req) => `${req.ip}-${req.raw.url.split('?')[0]}`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
114
116
|
|
|
115
117
|
if (config.dblist) {
|
|
116
118
|
dblistRoutes(fastify, opt);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import buttonAdd from '../utils/buttonAdd.js';
|
|
2
2
|
import buttonDel from '../utils/buttonDel.js';
|
|
3
3
|
import buttonEdit from '../utils/buttonEdit.js';
|
|
4
|
-
import button from '../utils/button.js';
|
|
4
|
+
import button from '../utils/button.js';
|
|
5
5
|
|
|
6
6
|
export default function buttonHelper(data, opt) {
|
|
7
7
|
const { hash } = opt;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import formatDate from './formatDate.js';
|
|
2
|
-
|
|
3
|
-
export default function formatAuto(data, options = {}) {
|
|
4
|
-
const format = options.hash?.format || 'text';
|
|
5
|
-
const auto = { true: 'так', false: 'ні' };
|
|
6
|
-
if (auto[data]) return auto[data];
|
|
7
|
-
if (['date'].includes(format)) {
|
|
8
|
-
return formatDate(data, options);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (typeof data === 'object') { return null; }
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
1
|
+
import formatDate from './formatDate.js';
|
|
2
|
+
|
|
3
|
+
export default function formatAuto(data, options = {}) {
|
|
4
|
+
const format = options.hash?.format || 'text';
|
|
5
|
+
const auto = { true: 'так', false: 'ні' };
|
|
6
|
+
if (auto[data]) return auto[data];
|
|
7
|
+
if (['date'].includes(format)) {
|
|
8
|
+
return formatDate(data, options);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (typeof data === 'object') { return null; }
|
|
12
|
+
return data;
|
|
13
|
+
}
|