@opengis/admin 0.4.23 → 0.4.25

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 (78) hide show
  1. package/README.md +97 -97
  2. package/dist/{add-page-8ASRlQMS.js → add-page-BylD41-Z.js} +1 -1
  3. package/dist/{admin-interface-BEb1DlT2.js → admin-interface-CYCND0UV.js} +19 -22
  4. package/dist/{admin-view-BcWfEfRW.js → admin-view-P4tmzsUd.js} +23 -28
  5. package/dist/admin.js +1 -1
  6. package/dist/admin.umd.cjs +8 -7
  7. package/dist/assets/logo.svg +41 -41
  8. package/dist/{card-view-BbzJnvoN.js → card-view-Cl-WJQjk.js} +1 -1
  9. package/dist/{edit-page-NFAOI00G.js → edit-page-QSqaQJID.js} +1 -1
  10. package/dist/{import-file-DJR1XXLF.js → import-file-CWSxHcF6.js} +2724 -2729
  11. package/dist/profile-page-BET5knoL.js +78 -0
  12. package/dist/style.css +1 -1
  13. package/dist/user-DCzCj0wb.js +2 -0
  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/cron.js +10 -10
  49. package/server/plugins/docs.js +28 -28
  50. package/server/routes/calendar/controllers/calendar.data.js +124 -124
  51. package/server/routes/calendar/index.mjs +7 -7
  52. package/server/routes/notifications/controllers/readNotifications.js +18 -18
  53. package/server/routes/notifications/controllers/testEmail.js +35 -35
  54. package/server/routes/notifications/controllers/userNotifications.js +53 -53
  55. package/server/routes/notifications/hook/onWidgetSet.js +56 -56
  56. package/server/routes/notifications/index.mjs +26 -26
  57. package/server/routes/root.mjs +3 -3
  58. package/server/routes/user/controllers/user.cls.id.js +14 -14
  59. package/server/routes/user/controllers/user.cls.js +72 -72
  60. package/server/routes/user/controllers/user.edit.js +19 -0
  61. package/server/routes/user/controllers/user.info.js +17 -17
  62. package/server/routes/user/index.mjs +6 -0
  63. package/server/templates/cls/itree.recrzone_category.json +73 -73
  64. package/server/templates/cls/test.json +9 -9
  65. package/server/templates/form/admin.user_cls.data.form.json +49 -49
  66. package/server/templates/form/admin.user_group_rel.form.json +21 -21
  67. package/server/templates/form/form-user-pass.json +10 -10
  68. package/server/templates/form/form-user_group.json +39 -39
  69. package/server/templates/form/form-users.json +156 -156
  70. package/server/templates/form/user_group_access.form.json +22 -22
  71. package/server/templates/select/account_id.json +2 -2
  72. package/server/templates/table/gis.dataset.table.json +43 -43
  73. package/server/templates/table/management.user_group.table.json +112 -112
  74. package/server/templates/table/management.users.table.json +126 -126
  75. package/server/utils/addNotification.js +21 -21
  76. package/server/utils/sendNotification.js +89 -89
  77. package/dist/profile-page-CBSCi6Db.js +0 -78
  78. package/dist/user-B_2kh6ic.js +0 -5
@@ -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,78 +0,0 @@
1
- import { _ as n, f as m } from "./import-file-DJR1XXLF.js";
2
- import { u as p } from "./user-B_2kh6ic.js";
3
- import { resolveComponent as f, createElementBlock as d, openBlock as u, createElementVNode as o, createBlock as h, createCommentVNode as b } from "vue";
4
- const x = {
5
- data() {
6
- return {
7
- formScheme: null,
8
- formValues: {}
9
- };
10
- },
11
- mounted() {
12
- this.getFormScheme();
13
- },
14
- computed: {
15
- userData() {
16
- return p.value;
17
- }
18
- },
19
- methods: {
20
- async updateUser() {
21
- var r;
22
- try {
23
- await m.put(`/user/${(r = this.userData.user) == null ? void 0 : r.uid}`, this.formValues), await this.$notify({
24
- title: "Успішно!",
25
- message: "Дані успішно оновлені",
26
- type: "success"
27
- });
28
- } catch {
29
- this.$notify({
30
- title: "Помилка!",
31
- message: "Сталася помилка",
32
- type: "error"
33
- });
34
- }
35
- },
36
- async getFormScheme() {
37
- var r, t, a, l;
38
- try {
39
- const { data: e } = await m.get(
40
- "/api/template/form/admin.profile.form"
41
- );
42
- console.log(this.userData);
43
- for (const s in e == null ? void 0 : e.schema)
44
- (t = (r = this.userData) == null ? void 0 : r.user) != null && t[s] && (this.formValues[s] = (l = (a = this.userData) == null ? void 0 : a.user) == null ? void 0 : l[s]);
45
- this.formScheme = e.schema;
46
- } catch (e) {
47
- console.error(e);
48
- }
49
- }
50
- }
51
- }, g = { class: "flex justify-center pt-[20px] pb-[20px] pl-[20px] h-[calc(100vh-58px)]" }, k = { class: "bg-white rounded-xl p-[20px]" }, y = { class: "flex-1 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500" }, w = { class: "flex" };
52
- function _(r, t, a, l, e, s) {
53
- const i = f("VsForm");
54
- return u(), d("div", g, [
55
- o("div", k, [
56
- t[2] || (t[2] = o("h2", { class: "mb-[20px] text-center" }, "Профіль", -1)),
57
- o("div", y, [
58
- e.formScheme ? (u(), h(i, {
59
- key: 0,
60
- scheme: e.formScheme,
61
- modelValue: e.formValues,
62
- "onUpdate:modelValue": t[0] || (t[0] = (c) => e.formValues = c),
63
- class: "pb-0"
64
- }, null, 8, ["scheme", "modelValue"])) : b("", !0),
65
- o("div", w, [
66
- o("button", {
67
- onClick: t[1] || (t[1] = (...c) => s.updateUser && s.updateUser(...c)),
68
- class: "ml-auto text-[18px] bg-blue-500 text-white px-[8px] py-[4px] rounded hover:bg-blue-700 duration-300"
69
- }, " Зберегти ")
70
- ])
71
- ])
72
- ])
73
- ]);
74
- }
75
- const D = /* @__PURE__ */ n(x, [["render", _]]);
76
- export {
77
- D as default
78
- };
@@ -1,5 +0,0 @@
1
- import { ref as r } from "vue";
2
- const e = r(null);
3
- export {
4
- e as u
5
- };