adminizer 4.3.0-build.80 → 4.3.0-build.81

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 (167) hide show
  1. package/assets/add-ChaPnvFv.js +1 -0
  2. package/assets/{add-form-C04ZI5LT.js → add-form-DNqlORQQ.js} +1 -1
  3. package/assets/add-group-D6YsQVrC.js +1 -0
  4. package/assets/{add-group-form-CyRwxTs3.js → add-group-form-CDi1y4af.js} +1 -1
  5. package/assets/{add-user-form-yp020h4r.js → add-user-form-BzXHahSY.js} +1 -1
  6. package/assets/add-user-psdNyGx8.js +1 -0
  7. package/assets/{app-CpGtjhxF.css → app-PLVuwM-H.css} +1 -1
  8. package/assets/{app-layout-BmT5KQwc.js → app-layout-AWzEe1aH.js} +1 -1
  9. package/assets/{app-sidebar-4lm9f_CG.js → app-sidebar-Bd4nWVXq.js} +1 -1
  10. package/assets/app-sidebar-header-jBFp1qZb.js +1 -0
  11. package/assets/app.js +3 -3
  12. package/assets/{catalog-CG_EB2kz.js → catalog-XiWBZptC.js} +1 -1
  13. package/assets/{dashboard-CsmJfdLb.js → dashboard-DcRJErQB.js} +1 -1
  14. package/assets/date-picker-A6CYw4SC.js +1 -0
  15. package/assets/del-modal-0klf0PNC.js +1 -0
  16. package/assets/{field-renderer-Bp1lfm0v.js → field-renderer-CYB5W2He.js} +3 -3
  17. package/assets/form-B-he6_tT.js +1 -0
  18. package/assets/{form-CSTeMDf5.js → form-BGRpsR-M.js} +1 -1
  19. package/assets/{home-D00XjLjD.js → home-B7aZTHTv.js} +2 -2
  20. package/assets/icon-k6999vVE.js +1 -0
  21. package/assets/{init-user-L-oxFTOv.js → init-user-Btm16ElL.js} +1 -1
  22. package/assets/input-error-Dbp_lp61.js +1 -0
  23. package/assets/list-_tZumymo.js +1 -0
  24. package/assets/{list-table-vIvydJV2.js → list-table-OzVUH7i4.js} +4 -4
  25. package/assets/{login-DLMJ6l_r.js → login-DeqxLVx3.js} +1 -1
  26. package/assets/manifest.json +74 -74
  27. package/assets/material-icon-B9BY_7p9.js +1 -0
  28. package/assets/{media-manager-ASGJ4PcS.js → media-manager-DQ5CA_na.js} +1 -1
  29. package/assets/{module-mxngd2cA.js → module-Drcr0QjC.js} +1 -1
  30. package/assets/{nav-footer-DbGCtmmN.js → nav-footer-DWHxIgb7.js} +1 -1
  31. package/assets/{nav-main-BcWhl71g.js → nav-main-CRT9ezos.js} +1 -1
  32. package/assets/notification-C7K-zK4k.js +27 -0
  33. package/assets/{register-C_W_hOmq.js → register-CMhPasDj.js} +1 -1
  34. package/assets/tabs-GDFuClHU.js +1 -0
  35. package/assets/{theme-switcher-D1G6OSMc.js → theme-switcher-C35zBCil.js} +1 -1
  36. package/assets/{welcome-FHRCdke0.js → welcome-CbhDDQlg.js} +1 -1
  37. package/controllers/add.js +1 -1
  38. package/controllers/catalog/FrontentCatalogAdapter.d.ts +4 -4
  39. package/controllers/edit.js +1 -15
  40. package/controllers/list.js +2 -2
  41. package/controllers/login.js +2 -2
  42. package/controllers/navigation/edit.js +1 -1
  43. package/controllers/notifications/NotificationController.d.ts +5 -5
  44. package/controllers/notifications/NotificationController.js +77 -78
  45. package/controllers/remove.js +1 -11
  46. package/controllers/view.js +1 -1
  47. package/helpers/configHelper.d.ts +1 -1
  48. package/helpers/fieldsHelper.d.ts +1 -1
  49. package/helpers/fieldsHelper.js +1 -1
  50. package/helpers/inertiaAddHelper.d.ts +1 -1
  51. package/helpers/translationHelper.d.ts +1 -1
  52. package/helpers/translationHelper.js +1 -1
  53. package/index.d.ts +14 -13
  54. package/index.js +14 -13
  55. package/interfaces/adminpanelConfig.d.ts +1 -1
  56. package/interfaces/global.d.ts +3 -3
  57. package/interfaces/types.d.ts +10 -1
  58. package/lib/Adminizer.d.ts +7 -7
  59. package/lib/Adminizer.js +7 -7
  60. package/lib/{v4/DataAccessor.d.ts → DataAccessor.d.ts} +4 -4
  61. package/lib/{v4/DataAccessor.js → DataAccessor.js} +3 -3
  62. package/lib/{v4/I18n.js → I18n.js} +2 -2
  63. package/lib/{v4/PolicyManager.d.ts → PolicyManager.d.ts} +1 -1
  64. package/lib/{v4/PolicyManager.js → PolicyManager.js} +2 -2
  65. package/lib/{v4/catalog → catalog}/AbstractCatalog.d.ts +1 -1
  66. package/lib/{v4/catalog → catalog}/Navigation.d.ts +2 -2
  67. package/lib/{v4/catalog → catalog}/Navigation.js +1 -1
  68. package/lib/{v4/controls → controls}/AbstractControls.d.ts +1 -1
  69. package/lib/{v4/controls → controls}/codeEditor/MonacoEditor.d.ts +1 -1
  70. package/lib/{v4/controls → controls}/geojsoneditor/GeoEditor.d.ts +1 -1
  71. package/lib/{v4/controls → controls}/jsoneditor/JsonEditor.d.ts +1 -1
  72. package/lib/{v4/controls → controls}/markdown/ToastUiEditor.d.ts +1 -1
  73. package/lib/{v4/controls → controls}/table/Handsontable.d.ts +1 -1
  74. package/lib/{v4/controls → controls}/wysiwyg/CKeditor.d.ts +1 -1
  75. package/lib/{v4/datatable → datatable}/NodeTable.d.ts +1 -1
  76. package/lib/{v4/model → model}/AbstractModel.d.ts +12 -0
  77. package/lib/model/AbstractModel.js +178 -0
  78. package/lib/{v4/model → model}/ModelHandler.js +1 -1
  79. package/lib/{v4/model → model}/adapter/sequelize.d.ts +0 -1
  80. package/lib/{v4/model → model}/adapter/sequelize.js +6 -3
  81. package/lib/{v4/notifications → notifications}/AbstractNotificationService.d.ts +14 -7
  82. package/lib/notifications/AbstractNotificationService.js +233 -0
  83. package/lib/{v4/notifications → notifications}/GeneralNotificationService.d.ts +1 -1
  84. package/lib/{v4/notifications → notifications}/GeneralNotificationService.js +4 -2
  85. package/lib/notifications/NotificationHandler.d.ts +27 -0
  86. package/lib/notifications/NotificationHandler.js +41 -0
  87. package/lib/{v4/notifications → notifications}/SystemNotificationService.d.ts +5 -4
  88. package/lib/notifications/SystemNotificationService.js +173 -0
  89. package/lib/{v4/widgets → widgets}/abstractCustom.d.ts +1 -1
  90. package/lib/{v4/widgets → widgets}/abstractLink.d.ts +1 -1
  91. package/lib/{v4/widgets → widgets}/abstractWidgetBase.d.ts +1 -1
  92. package/lib/{v4/widgets → widgets}/widgetHandler.d.ts +2 -2
  93. package/migrations/index.d.ts +3 -0
  94. package/migrations/index.js +4 -0
  95. package/migrations/index.ts +5 -0
  96. package/migrations/umzug/0001.d.ts +7 -0
  97. package/migrations/umzug/0001.js +119 -0
  98. package/migrations/umzug/0001.ts +132 -0
  99. package/migrations/umzug.d.ts +2 -0
  100. package/migrations/umzug.js +8 -0
  101. package/migrations/umzug.ts +9 -0
  102. package/models/NotificationAP.d.ts +8 -0
  103. package/models/NotificationAP.js +8 -0
  104. package/models/UserAP.d.ts +1 -1
  105. package/package.json +5 -4
  106. package/system/Router.js +4 -8
  107. package/system/bindControls.js +6 -6
  108. package/system/bindInertia.js +4 -3
  109. package/system/bindNavigation.js +1 -1
  110. package/system/bindNotifications.js +3 -3
  111. package/system/bindReqFunctions.js +8 -25
  112. package/system/defaults.js +1 -1
  113. package/ui/components/ui/table.d.ts +1 -1
  114. package/ui/components/ui/table.js +2 -2
  115. package/assets/add-DSapOiv0.js +0 -1
  116. package/assets/add-group-DWR7SBTO.js +0 -1
  117. package/assets/add-user-acATGxUL.js +0 -1
  118. package/assets/app-sidebar-header-CxXmzszq.js +0 -1
  119. package/assets/date-picker-By3kj-Rx.js +0 -1
  120. package/assets/del-modal-DlcbcdR5.js +0 -1
  121. package/assets/form-CxHRGp7p.js +0 -1
  122. package/assets/icon-ButfCBrt.js +0 -1
  123. package/assets/input-error-CHsDLcK0.js +0 -1
  124. package/assets/list-4TOTsjqE.js +0 -1
  125. package/assets/material-icon-sXk4BK-N.js +0 -1
  126. package/assets/notification-BEfA5sT6.js +0 -1
  127. package/assets/tabs-CgZW_LLn.js +0 -1
  128. package/lib/v4/model/AbstractModel.js +0 -79
  129. package/lib/v4/notifications/AbstractNotificationService.js +0 -150
  130. package/lib/v4/notifications/NotificationHandler.d.ts +0 -69
  131. package/lib/v4/notifications/NotificationHandler.js +0 -127
  132. package/lib/v4/notifications/SystemNotificationService.js +0 -124
  133. /package/lib/{v4/I18n.d.ts → I18n.d.ts} +0 -0
  134. /package/lib/{v4/POWCaptcha.d.ts → POWCaptcha.d.ts} +0 -0
  135. /package/lib/{v4/POWCaptcha.js → POWCaptcha.js} +0 -0
  136. /package/lib/{v4/catalog → catalog}/AbstractCatalog.js +0 -0
  137. /package/lib/{v4/catalog → catalog}/CatalogHandler.d.ts +0 -0
  138. /package/lib/{v4/catalog → catalog}/CatalogHandler.js +0 -0
  139. /package/lib/{v4/controls → controls}/AbstractControls.js +0 -0
  140. /package/lib/{v4/controls → controls}/ControlsHandler.d.ts +0 -0
  141. /package/lib/{v4/controls → controls}/ControlsHandler.js +0 -0
  142. /package/lib/{v4/controls → controls}/codeEditor/MonacoEditor.js +0 -0
  143. /package/lib/{v4/controls → controls}/geojsoneditor/GeoEditor.js +0 -0
  144. /package/lib/{v4/controls → controls}/jsoneditor/JsonEditor.js +0 -0
  145. /package/lib/{v4/controls → controls}/markdown/ToastUiEditor.js +0 -0
  146. /package/lib/{v4/controls → controls}/table/Handsontable.js +0 -0
  147. /package/lib/{v4/controls → controls}/wysiwyg/CKeditor.js +0 -0
  148. /package/lib/{v4/datatable → datatable}/NodeTable.js +0 -0
  149. /package/lib/{v4/helper → helper}/jwt.d.ts +0 -0
  150. /package/lib/{v4/helper → helper}/jwt.js +0 -0
  151. /package/lib/{v4/inertia → inertia}/flash.d.ts +0 -0
  152. /package/lib/{v4/inertia → inertia}/flash.js +0 -0
  153. /package/lib/{v4/inertia → inertia}/inertiaAdapter.d.ts +0 -0
  154. /package/lib/{v4/inertia → inertia}/inertiaAdapter.js +0 -0
  155. /package/lib/{v4/model → model}/ModelHandler.d.ts +0 -0
  156. /package/lib/{v4/model → model}/adapter/waterline.d.ts +0 -0
  157. /package/lib/{v4/model → model}/adapter/waterline.js +0 -0
  158. /package/lib/{v4/widgets → widgets}/abstractAction.d.ts +0 -0
  159. /package/lib/{v4/widgets → widgets}/abstractAction.js +0 -0
  160. /package/lib/{v4/widgets → widgets}/abstractCustom.js +0 -0
  161. /package/lib/{v4/widgets → widgets}/abstractInfo.d.ts +0 -0
  162. /package/lib/{v4/widgets → widgets}/abstractInfo.js +0 -0
  163. /package/lib/{v4/widgets → widgets}/abstractLink.js +0 -0
  164. /package/lib/{v4/widgets → widgets}/abstractSwitch.d.ts +0 -0
  165. /package/lib/{v4/widgets → widgets}/abstractSwitch.js +0 -0
  166. /package/lib/{v4/widgets → widgets}/abstractWidgetBase.js +0 -0
  167. /package/lib/{v4/widgets → widgets}/widgetHandler.js +0 -0
@@ -1,127 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- import { Adminizer } from '../../Adminizer';
3
- export class NotificationHandler extends EventEmitter {
4
- services = new Map();
5
- constructor() {
6
- super();
7
- }
8
- /**
9
- * Register a new notification service
10
- * @param service
11
- */
12
- registerService(service) {
13
- this.services.set(service.notificationClass, service);
14
- Adminizer.log.info(`Notification service registered: ${service.notificationClass}`);
15
- }
16
- /**
17
- * Remove a notification service
18
- * @param notificationClass
19
- */
20
- removeService(notificationClass) {
21
- if (this.services.has(notificationClass)) {
22
- this.services.delete(notificationClass);
23
- Adminizer.log.info(`Notification service removed: ${notificationClass}`);
24
- }
25
- }
26
- /**
27
- * Get a notification service by class
28
- * @param notificationClass
29
- */
30
- getService(notificationClass) {
31
- return this.services.get(notificationClass);
32
- }
33
- /**
34
- * Get all registered services
35
- */
36
- getAllServices() {
37
- return Array.from(this.services.values());
38
- }
39
- /**
40
- * Dispatch a notification to a service
41
- * @param notificationClass
42
- * @param notification
43
- */
44
- async dispatchNotification(notificationClass, notification) {
45
- const service = this.getService(notificationClass);
46
- if (!service) {
47
- throw new Error(`Notification service not found: ${notificationClass}`);
48
- }
49
- return service.dispatchNotification(notification);
50
- }
51
- /**
52
- * Get notifications by class
53
- * @param notificationClass
54
- * @param userId
55
- * @param limit
56
- * @param unreadOnly
57
- */
58
- async getNotifications(notificationClass, userId, limit, unreadOnly) {
59
- const service = this.getService(notificationClass);
60
- if (!service) {
61
- throw new Error(`Notification service not found: ${notificationClass}`);
62
- }
63
- return service.getNotifications(userId, limit, unreadOnly);
64
- }
65
- /**
66
- * Get all notifications for a user
67
- * @param user
68
- * @param limit
69
- * @param unreadOnly
70
- */
71
- async getUserNotifications(user, limit = 50, unreadOnly = false) {
72
- const allNotifications = [];
73
- for (const service of this.getAllServices()) {
74
- // Для системных уведомлений проверяем права админа
75
- if (service.notificationClass === 'system') {
76
- if (this.isAdmin(user)) {
77
- const notifications = await service.getNotifications(user.id, limit, unreadOnly);
78
- allNotifications.push(...notifications);
79
- }
80
- }
81
- else {
82
- // Для остальных уведомлений получаем по пользователю
83
- const notifications = await service.getNotifications(user.id, limit, unreadOnly);
84
- allNotifications.push(...notifications);
85
- }
86
- }
87
- // Сортируем по дате создания
88
- return allNotifications.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()).slice(0, limit);
89
- }
90
- /**
91
- * Mark a notification as read
92
- * @param notificationClass
93
- * @param id
94
- * @param userId
95
- */
96
- async markAsRead(notificationClass, id, userId) {
97
- const service = this.getService(notificationClass);
98
- if (!service) {
99
- throw new Error(`Notification service not found: ${notificationClass}`);
100
- }
101
- return service.markAsRead(userId, id);
102
- }
103
- /**
104
- * Check if user is admin
105
- * @param user
106
- * @private
107
- */
108
- isAdmin(user) {
109
- if (!user)
110
- return false;
111
- return user.isAdministrator === true;
112
- }
113
- /**
114
- * Get client count for a notification class
115
- * @param notificationClass
116
- */
117
- getClientCount(notificationClass) {
118
- const service = this.getService(notificationClass);
119
- return service ? service.getClientCount() : 0;
120
- }
121
- /**
122
- * Get total client count
123
- */
124
- getTotalClientCount() {
125
- return this.getAllServices().reduce((total, service) => total + service.getClientCount(), 0);
126
- }
127
- }
@@ -1,124 +0,0 @@
1
- import { AbstractNotificationService } from './AbstractNotificationService';
2
- import { Adminizer } from '../../Adminizer';
3
- export class SystemNotificationService extends AbstractNotificationService {
4
- notificationClass = 'system';
5
- icon = 'settings';
6
- iconColor = '#1eb707';
7
- // Добавляем каналы для CRUD операций
8
- crudChannels = new Map();
9
- async dispatchNotification(notification) {
10
- const fullNotification = {
11
- ...notification,
12
- notificationClass: this.notificationClass,
13
- channel: notification.channel ?? ''
14
- };
15
- let notificationDB;
16
- // Сохраняем в базу
17
- if (this.adminizer.modelHandler.model.has('notificationap')) {
18
- try {
19
- // Idia how to keep in DB notification raw data ['user %s created %s in model %s', user, instance.name, modelName] as print_f()
20
- notificationDB = await this.adminizer.modelHandler.model.get('notificationap')["_create"](fullNotification);
21
- const users = await this.adminizer.modelHandler.model.get('userap')["_find"]({ isAdministrator: 1 });
22
- for (const user of users) {
23
- try {
24
- await this.createUserNotification(notificationDB.id, user.id);
25
- }
26
- catch (error) {
27
- Adminizer.log.error('Error creating UserNotificationAP:', error);
28
- }
29
- }
30
- const event = {
31
- type: 'notification',
32
- data: {
33
- ...notificationDB,
34
- icon: {
35
- icon: this.icon,
36
- iconColor: this.iconColor
37
- },
38
- },
39
- notificationClass: this.notificationClass,
40
- userId: notification.userId ?? null,
41
- channel: notification.channel ?? 'system' // Добавляем информацию о канале
42
- };
43
- // Отправляем на все каналы или на конкретный канал
44
- if (notification.channel) {
45
- this.broadcastToChannel(notification.channel, event);
46
- }
47
- else {
48
- this.broadcastToChannel('system', event);
49
- }
50
- Adminizer.log.info(`[System] Notification dispatched: ${fullNotification.title}`);
51
- return true;
52
- }
53
- catch (error) {
54
- Adminizer.log.error('Error saving system notification to database:', error);
55
- }
56
- }
57
- return false;
58
- }
59
- // Метод для отправки на конкретный канал
60
- broadcastToChannel(channel, event) {
61
- const channelClients = this.crudChannels.get(channel);
62
- if (channelClients) {
63
- channelClients.forEach(clientId => {
64
- const sendFn = this.clients.get(clientId);
65
- if (sendFn) {
66
- try {
67
- sendFn(event);
68
- }
69
- catch (error) {
70
- Adminizer.log.error(`[${this.notificationClass}] Error sending to client ${clientId} on channel ${channel}:`, error);
71
- this.removeClient(clientId);
72
- }
73
- }
74
- });
75
- }
76
- }
77
- // Добавляем клиента к каналу
78
- addClientToChannel(clientId, channel) {
79
- if (!this.crudChannels.has(channel)) {
80
- this.crudChannels.set(channel, new Set());
81
- }
82
- this.crudChannels.get(channel).add(clientId);
83
- Adminizer.log.info(`[${this.notificationClass}] Client ${clientId} added to channel ${channel}`);
84
- }
85
- // Удаляем клиента из канала
86
- removeClientFromChannel(clientId, channel) {
87
- const channelClients = this.crudChannels.get(channel);
88
- if (channelClients) {
89
- channelClients.delete(clientId);
90
- Adminizer.log.info(`[${this.notificationClass}] Client ${clientId} removed from channel ${channel}`);
91
- }
92
- }
93
- // Удаляем клиента из всех каналов
94
- removeClientFromAllChannels(clientId) {
95
- this.crudChannels.forEach((clients, channel) => {
96
- clients.delete(clientId);
97
- Adminizer.log.info(`[${this.notificationClass}] Client ${clientId} removed from channel ${channel}`);
98
- });
99
- }
100
- // Переопределяем removeClient для очистки каналов
101
- removeClient(clientId) {
102
- super.removeClient(clientId);
103
- this.removeClientFromAllChannels(clientId);
104
- }
105
- // Специальный метод для системных событий с указанием канала
106
- async logSystemEvent(title, message, channel, metadata) {
107
- return this.dispatchNotification({
108
- title: title,
109
- message: message,
110
- metadata: metadata,
111
- channel: channel
112
- });
113
- }
114
- // Методы для CRUD операций
115
- async logCreatedEvent(title, message, metadata) {
116
- return this.logSystemEvent(title, message, 'created', metadata);
117
- }
118
- async logUpdatedEvent(title, message, metadata) {
119
- return this.logSystemEvent(title, message, 'updated', metadata);
120
- }
121
- async logDeletedEvent(title, message, metadata) {
122
- return this.logSystemEvent(title, message, 'deleted', metadata);
123
- }
124
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes