@opengis/admin 0.3.102 → 0.3.104

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 (116) hide show
  1. package/README.md +97 -97
  2. package/config.js +4 -4
  3. package/dist/add-page-CxrU5Q4l.js +127 -0
  4. package/dist/{admin-interface-mIo1_gE2.js → admin-interface-AsvHxkp6.js} +654 -684
  5. package/dist/admin-view-C7QW8ebw.js +703 -0
  6. package/dist/admin.js +1 -1
  7. package/dist/admin.umd.cjs +82 -82
  8. package/dist/assets/logo.svg +41 -41
  9. package/dist/{card-view-BPUveYDd.js → card-view-SiUXOypt.js} +1 -1
  10. package/dist/edit-page-PXfumoJ-.js +145 -0
  11. package/dist/{import-file-Bs86FUW3.js → import-file-KkQTE8rh.js} +19705 -19959
  12. package/dist/{profile-page-DHRxyJA_.js → profile-page-B8ZKBocp.js} +4 -4
  13. package/dist/style.css +1 -1
  14. package/module/settings/card/admin.accounts.table/index.yml +7 -7
  15. package/module/settings/card/admin.accounts.table/rules.hbs +18 -18
  16. package/module/settings/card/admin.accounts.table/users.hbs +13 -13
  17. package/module/settings/card/admin.routes.table/groups.hbs +11 -11
  18. package/module/settings/card/admin.routes.table/users.hbs +16 -16
  19. package/module/settings/cls/core.actions.json +17 -17
  20. package/module/settings/cls/core.scope.json +13 -13
  21. package/module/settings/cls/properties.site_status.json +13 -13
  22. package/module/settings/cls/properties.widget_status.json +13 -13
  23. package/module/settings/cls/yes_no.json +11 -11
  24. package/module/settings/form/admin.accounts.form.json +13 -13
  25. package/module/settings/form/admin.properties.form.json +15 -15
  26. package/module/settings/form/admin.roles.form.json +21 -21
  27. package/module/settings/form/admin.user_properties.form.json +15 -15
  28. package/module/settings/form/admin.user_roles_card.form.json +13 -13
  29. package/module/settings/interface/admin.properties.json +4 -4
  30. package/module/settings/interface/admin.roles.json +4 -4
  31. package/module/settings/interface/admin.routes.json +4 -4
  32. package/module/settings/interface/admin.users.json +4 -4
  33. package/module/settings/select/core.routes.sql +1 -1
  34. package/module/settings/select/core.user_mentioned.sql +1 -1
  35. package/module/settings/select/core.user_uid.sql +1 -1
  36. package/module/settings/table/admin.properties.table.json +39 -39
  37. package/module/settings/table/admin.user_properties.table.json +34 -34
  38. package/package.json +1 -1
  39. package/server/helpers/core/coalesce.js +7 -7
  40. package/server/helpers/core/select.js +48 -48
  41. package/server/helpers/core/token.js +18 -18
  42. package/server/helpers/list/buttonHelper.js +21 -21
  43. package/server/helpers/list/utils/button.js +5 -5
  44. package/server/helpers/temp/contentList.js +58 -58
  45. package/server/helpers/temp/ifCond.js +101 -101
  46. package/server/helpers/utils/button.js +5 -5
  47. package/server/helpers/utils/mdToHTML.js +17 -17
  48. package/server/plugins/access/index.mjs +6 -6
  49. package/server/plugins/adminHook.js +81 -81
  50. package/server/plugins/cron.js +10 -10
  51. package/server/plugins/docs.js +28 -28
  52. package/server/routes/access/controllers/access.group.js +29 -29
  53. package/server/routes/access/controllers/access.group.post.js +54 -54
  54. package/server/routes/access/index.mjs +11 -11
  55. package/server/routes/access/schema.mjs +67 -67
  56. package/server/routes/calendar/controllers/calendar.data.js +125 -125
  57. package/server/routes/calendar/index.mjs +7 -7
  58. package/server/routes/calendar/schema.js +21 -21
  59. package/server/routes/data/controllers/cardTabData.js +49 -49
  60. package/server/routes/data/controllers/funcs/getFilterSQL/index.js +92 -92
  61. package/server/routes/data/controllers/funcs/getFilterSQL/util/formatValue.js +170 -170
  62. package/server/routes/data/controllers/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
  63. package/server/routes/data/controllers/funcs/getFilterSQL/util/getFilterQuery.js +64 -64
  64. package/server/routes/data/controllers/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
  65. package/server/routes/data/controllers/funcs/getFilterSQL/util/getTableSql.js +34 -34
  66. package/server/routes/data/controllers/tableDataId.js +27 -27
  67. package/server/routes/data/controllers/tokenInfo.js +9 -9
  68. package/server/routes/data/controllers/utils/assignTokens.js +30 -30
  69. package/server/routes/data/controllers/utils/conditions.js +20 -20
  70. package/server/routes/data/controllers/utils/getColumns.js +8 -8
  71. package/server/routes/data/index.mjs +20 -20
  72. package/server/routes/data/schema.js +54 -54
  73. package/server/routes/notifications/controllers/readNotifications.js +18 -18
  74. package/server/routes/notifications/controllers/testEmail.js +35 -35
  75. package/server/routes/notifications/controllers/userNotifications.js +53 -53
  76. package/server/routes/notifications/hook/onWidgetSet.js +56 -56
  77. package/server/routes/notifications/index.mjs +26 -26
  78. package/server/routes/notifications/schema.js +16 -16
  79. package/server/routes/properties/schema.js +10 -10
  80. package/server/routes/report/controllers/list.js +21 -21
  81. package/server/routes/report/controllers/tableData.js +107 -112
  82. package/server/routes/report/controllers/widgetData.js +104 -90
  83. package/server/routes/report/index.mjs +9 -9
  84. package/server/routes/report/utils/formatValue.js +179 -179
  85. package/server/routes/root.mjs +3 -3
  86. package/server/routes/templates/controllers/getTemplate.js +44 -44
  87. package/server/routes/templates/schema.js +8 -8
  88. package/server/routes/user/controllers/user.cls.id.js +14 -14
  89. package/server/routes/user/controllers/user.cls.js +72 -72
  90. package/server/routes/user/controllers/user.info.js +17 -17
  91. package/server/routes/user/schema.js +14 -14
  92. package/server/routes/util/controllers/code.generator.js +89 -89
  93. package/server/routes/widget/controllers/widget.del.js +80 -80
  94. package/server/routes/widget/controllers/widget.set.js +101 -101
  95. package/server/routes/widget/hook/onWidgetSet.js +12 -12
  96. package/server/routes/widget/index.mjs +20 -20
  97. package/server/routes/widget/schema.js +12 -12
  98. package/server/templates/cls/itree.recrzone_category.json +73 -73
  99. package/server/templates/cls/test.json +9 -9
  100. package/server/templates/form/admin.user_cls.data.form.json +49 -49
  101. package/server/templates/form/admin.user_group_rel.form.json +21 -21
  102. package/server/templates/form/form-user-pass.json +10 -10
  103. package/server/templates/form/form-user_group.json +39 -39
  104. package/server/templates/form/form-users.json +156 -156
  105. package/server/templates/form/user_group_access.form.json +22 -22
  106. package/server/templates/select/account_id.json +2 -2
  107. package/server/templates/table/gis.dataset.table.json +43 -43
  108. package/server/templates/table/management.user_group.table.json +112 -112
  109. package/server/templates/table/management.users.table.json +126 -126
  110. package/server/utils/addNotification.js +21 -21
  111. package/server/utils/sendNotification.js +89 -89
  112. package/dist/add-page-BtME1JJf.js +0 -126
  113. package/dist/admin-view-URsx4MBX.js +0 -1018
  114. package/dist/assets/images/eye.svg +0 -4
  115. package/dist/assets/images/file-up.svg +0 -6
  116. package/dist/edit-page-DVyHgdP0.js +0 -154
@@ -1,89 +1,89 @@
1
- import { handlebars, pgClients, getTemplate, getRedis, logger } from '@opengis/fastify-table/utils.js';
2
-
3
- import sendEmail from './sendEmail.js';
4
-
5
- // eslint-disable-next-line max-len, no-control-regex
6
- const emailReg = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/g;
7
-
8
- const rclient = getRedis();
9
-
10
- async function generateNotificationContent({
11
- pg, table, template, id, message, data: data1,
12
- }) {
13
- if (template) {
14
- const data = table && id ? await pg.one(`select * from ${table} where ${pg.pk[table]}=$1`, [id]) : data1;
15
- // console.log(data);
16
- const body = await getTemplate('pt', template);
17
- // console.log(body);
18
- const html = handlebars.compile(body || template || 'template not found')(data || {});
19
- // console.log(html);
20
- return html;
21
- }
22
- return message;
23
- }
24
-
25
- // to do: refactor fastify-file to remove funcs completely
26
- export default async function notification({
27
- pg = pgClients.client,
28
- provider = ['email'],
29
- from,
30
- to,
31
- template,
32
- table,
33
- message,
34
- title,
35
- file,
36
- data,
37
- id,
38
- nocache,
39
- }) {
40
- if (pg?.readonly) {
41
- return null;
42
- }
43
-
44
- const keyTo = `${pg.options?.database}:mail:${provider[0]}:${to || ''}${id || ''}${table || ''}${title || ''}`;
45
- const uniqueTo = await rclient.setnx(keyTo, 1);
46
-
47
- if (!uniqueTo && !nocache) {
48
- logger.file('notification/sent', { keyTo, send: uniqueTo, nocache });
49
- return `already sent: ${keyTo}`;
50
- }
51
- await rclient.expire(keyTo, 1000 * 600);
52
-
53
- if (!to.length) {
54
- return null;
55
- }
56
-
57
- if (!(Array.isArray(provider) && provider.length)) {
58
- return 'notification provider - must be array and not empty';
59
- }
60
-
61
- const html = await generateNotificationContent({
62
- pg, table, template, id, message, data,
63
- });
64
-
65
- if (provider.includes('email')) {
66
- const files = Array.isArray(file) ? file : [file];
67
- const attachments = files?.length && false ? await Promise.all(files?.filter((el) => el).map(async (el) => {
68
- /* const content = await downloadFile(el, { buffer: true }); // ?
69
- return {
70
- filename: el.split('/').pop(),
71
- encoding: 'base64',
72
- content,
73
- }; */
74
- })) : [];
75
-
76
- const toEmail = Array.isArray(to) ? to.map((emails) => emails.match(emailReg)?.join(',')) : to;
77
-
78
- const result = await sendEmail({
79
- attachments,
80
- html,
81
- subject: title,
82
- from,
83
- to: toEmail,
84
- });
85
-
86
- return result;
87
- }
88
- return null;
89
- }
1
+ import { handlebars, pgClients, getTemplate, getRedis, logger } from '@opengis/fastify-table/utils.js';
2
+
3
+ import sendEmail from './sendEmail.js';
4
+
5
+ // eslint-disable-next-line max-len, no-control-regex
6
+ const emailReg = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/g;
7
+
8
+ const rclient = getRedis();
9
+
10
+ async function generateNotificationContent({
11
+ pg, table, template, id, message, data: data1,
12
+ }) {
13
+ if (template) {
14
+ const data = table && id ? await pg.one(`select * from ${table} where ${pg.pk[table]}=$1`, [id]) : data1;
15
+ // console.log(data);
16
+ const body = await getTemplate('pt', template);
17
+ // console.log(body);
18
+ const html = handlebars.compile(body || template || 'template not found')(data || {});
19
+ // console.log(html);
20
+ return html;
21
+ }
22
+ return message;
23
+ }
24
+
25
+ // to do: refactor fastify-file to remove funcs completely
26
+ export default async function notification({
27
+ pg = pgClients.client,
28
+ provider = ['email'],
29
+ from,
30
+ to,
31
+ template,
32
+ table,
33
+ message,
34
+ title,
35
+ file,
36
+ data,
37
+ id,
38
+ nocache,
39
+ }) {
40
+ if (pg?.readonly) {
41
+ return null;
42
+ }
43
+
44
+ const keyTo = `${pg.options?.database}:mail:${provider[0]}:${to || ''}${id || ''}${table || ''}${title || ''}`;
45
+ const uniqueTo = await rclient.setnx(keyTo, 1);
46
+
47
+ if (!uniqueTo && !nocache) {
48
+ logger.file('notification/sent', { keyTo, send: uniqueTo, nocache });
49
+ return `already sent: ${keyTo}`;
50
+ }
51
+ await rclient.expire(keyTo, 1000 * 600);
52
+
53
+ if (!to.length) {
54
+ return null;
55
+ }
56
+
57
+ if (!(Array.isArray(provider) && provider.length)) {
58
+ return 'notification provider - must be array and not empty';
59
+ }
60
+
61
+ const html = await generateNotificationContent({
62
+ pg, table, template, id, message, data,
63
+ });
64
+
65
+ if (provider.includes('email')) {
66
+ const files = Array.isArray(file) ? file : [file];
67
+ const attachments = files?.length && false ? await Promise.all(files?.filter((el) => el).map(async (el) => {
68
+ /* const content = await downloadFile(el, { buffer: true }); // ?
69
+ return {
70
+ filename: el.split('/').pop(),
71
+ encoding: 'base64',
72
+ content,
73
+ }; */
74
+ })) : [];
75
+
76
+ const toEmail = Array.isArray(to) ? to.map((emails) => emails.match(emailReg)?.join(',')) : to;
77
+
78
+ const result = await sendEmail({
79
+ attachments,
80
+ html,
81
+ subject: title,
82
+ from,
83
+ to: toEmail,
84
+ });
85
+
86
+ return result;
87
+ }
88
+ return null;
89
+ }
@@ -1,126 +0,0 @@
1
- import { _ as d, s as f, u as g, g as m } from "./import-file-Bs86FUW3.js";
2
- import { resolveComponent as b, openBlock as h, createElementBlock as x, createElementVNode as i, normalizeClass as y, normalizeStyle as p, createBlock as w, createCommentVNode as v } from "vue";
3
- const $ = {
4
- data() {
5
- return {
6
- formValues: {},
7
- scheme: null,
8
- table: "",
9
- token: "",
10
- api: "",
11
- style: null
12
- };
13
- },
14
- mounted() {
15
- this.getFormScheme();
16
- },
17
- computed: {
18
- color() {
19
- return f.value.buttonColor || "blue";
20
- }
21
- },
22
- methods: {
23
- flattenMenu(t) {
24
- const e = [];
25
- return t.forEach((a) => {
26
- a.menu ? e.push(...this.flattenMenu(a.menu)) : e.push(a);
27
- }), e;
28
- },
29
- async getFormScheme() {
30
- var l, o;
31
- const t = this.flattenMenu(g.value);
32
- t != null && t.length || this.$router.replace("/404");
33
- const e = t == null ? void 0 : t.find((s) => {
34
- var r, n;
35
- return (s == null ? void 0 : s.path) == ((n = (r = this.$route) == null ? void 0 : r.query) == null ? void 0 : n.table);
36
- });
37
- e || this.$router.replace("/404");
38
- const a = e == null ? void 0 : e.table;
39
- this.table = a;
40
- try {
41
- const s = await m.get(`/api/table-data/${a}`), { data: r } = await m.get(
42
- `/api/template/form/${(l = s == null ? void 0 : s.data) == null ? void 0 : l.form}`
43
- );
44
- this.scheme = (r == null ? void 0 : r.schema) || r, this.style = (r == null ? void 0 : r.style) || null, this.api = (r == null ? void 0 : r.api) || "", this.token = ((o = s == null ? void 0 : s.data) == null ? void 0 : o.addToken) || "";
45
- } catch {
46
- }
47
- },
48
- getGroupedErrorNotification(t, e) {
49
- if (!t || !e) return "";
50
- const a = {};
51
- return Object.entries(t).forEach(([o, s]) => {
52
- var n;
53
- const r = ((n = e[o]) == null ? void 0 : n.ua) || o;
54
- s.forEach((c) => {
55
- const u = c.message;
56
- a[u] || (a[u] = []), a[u].push(`"${r}"`);
57
- });
58
- }), Object.entries(a).map(([o, s]) => `<b>${o}:</b> ${s.join(", ")}`).join("<br>") || "Сталася помилка валідації";
59
- },
60
- async createObject() {
61
- var e, a, l;
62
- const t = (a = (e = this.$refs.form) == null ? void 0 : e.$refs) == null ? void 0 : a.form;
63
- try {
64
- await t.doValidation(), await m.post(
65
- this.api || `/api/table/${this.token}`,
66
- this.formValues
67
- ), await this.$router.back(), await this.$notify({
68
- title: "Успішно!",
69
- message: "Об'єкт успішно створено",
70
- type: "success"
71
- });
72
- } catch (o) {
73
- const s = this.getGroupedErrorNotification(
74
- t == null ? void 0 : t.formErrors,
75
- t == null ? void 0 : t.scheme
76
- );
77
- this.$notify({
78
- title: "Помилка!",
79
- message: ((l = o == null ? void 0 : o.response) == null ? void 0 : l.data) || s,
80
- type: "error"
81
- });
82
- }
83
- }
84
- }
85
- }, k = { class: "bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]" }, V = { class: "h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl" }, _ = { class: "flex items-center gap-[6px]" }, j = { class: "bg-white w-full rounded-xl" };
86
- function E(t, e, a, l, o, s) {
87
- var n;
88
- const r = b("VsFormWithNavigation");
89
- return h(), x("div", k, [
90
- i("div", V, [
91
- e[3] || (e[3] = i("h2", { class: "text-xl font-medium" }, "Створити", -1)),
92
- i("div", _, [
93
- i("button", {
94
- onClick: e[0] || (e[0] = (c) => t.$router.back()),
95
- class: "flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"
96
- }, " Скасувати "),
97
- i("button", {
98
- onClick: e[1] || (e[1] = (...c) => s.createObject && s.createObject(...c)),
99
- class: y(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${s.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${s.color}-800 hover:text-white`)
100
- }, " Зберегти ", 2)
101
- ])
102
- ]),
103
- i("div", {
104
- style: p({
105
- height: ((n = t.$adminSettings) == null ? void 0 : n.header) === !1 ? "calc(100vh - 91px)" : "calc(100vh - 150px)"
106
- }),
107
- class: "bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw] overflow-hidden"
108
- }, [
109
- i("div", j, [
110
- o.scheme ? (h(), w(r, {
111
- key: 0,
112
- ref: "form",
113
- scheme: o.scheme,
114
- style: p(o.style),
115
- modelValue: o.formValues,
116
- "onUpdate:modelValue": e[2] || (e[2] = (c) => o.formValues = c),
117
- class: "h-full p-[20px]"
118
- }, null, 8, ["scheme", "style", "modelValue"])) : v("", !0)
119
- ])
120
- ], 4)
121
- ]);
122
- }
123
- const N = /* @__PURE__ */ d($, [["render", E]]);
124
- export {
125
- N as default
126
- };